code: def load_configfile(configpath):
      "Loads a JSON or YAML configfile as a dict, then checks that it's a dict."
      config = _load_configfile(configpath)
      if not isinstance(config, dict):
          raise WorkflowError(
              "Config file must be given as JSON or YAML with keys at top level."
          )
      return config
  
imports: import collections
  import json
  from pathlib import Path
  from snakemake_interface_common.exceptions import WorkflowError
label_desc: Use image node_id 2 for calling a global function with example usage: load_configfile(configpath) and returns: config