code: def check_deepspeed_config(config):
      if isinstance(config, dict):
          return config
      elif os.path.exists(config):
          return json.load(
              open(config, "r"),
              object_pairs_hook=dict_raise_error_on_duplicate_keys,
          )
      else:
          raise ValueError(
              f"Expected a string path to an existing deepspeed config, or a dictionary. Received: {config}"
          )
  
file_path: DeepSpeed/deepspeed/compression/compress.py
imports: import re
  from .helper import compression_preparation, fix_compression, recursive_getattr, is_module_compressible
  from .config import get_compression_config
  from ..runtime.config_utils import dict_raise_error_on_duplicate_keys
  from .constants import *
  import os
  import json
label_desc: Use image node_id 1 for calling a global function with example usage: check_deepspeed_config(config) and returns: config, json