code: def _detect_compressor(fileobj):
      """Return the compressor matching fileobj.
  
      Parameters
      ----------
      fileobj: file object
  
      Returns
      -------
      str in {'zlib', 'gzip', 'bz2', 'lzma', 'xz', 'compat', 'not-compressed'}
      """
      # Read the magic number in the first bytes of the file.
      if hasattr(fileobj, "peek"):
          # Peek allows to read those bytes without moving the cursor in the
          # file whic.
          first_bytes = fileobj.peek(_MAX_PREFIX_LEN)
      else:
          # Fallback to seek if the fileobject is not peekable.
          first_bytes = fileobj.read(_MAX_PREFIX_LEN)
          fileobj.seek(0)
  
      if first_bytes.startswith(_ZLIB_PREFIX):
          return "zlib"
      elif first_bytes.startswith(_GZIP_PREFIX):
          return "gzip"
      elif first_bytes.startswith(_BZ2_PREFIX):
          return "bz2"
      elif first_bytes.startswith(_LZMA_PREFIX):
          return "lzma"
      elif first_bytes.startswith(_XZ_PREFIX):
          return "xz"
      elif first_bytes.startswith(_ZFILE_PREFIX):
          return "compat"
  
      return "not-compressed"
  
imports: import pickle
  import sys
  import io
  import zlib
  import gzip
  import warnings
  import contextlib
  from contextlib import closing
  from ._compat import PY3_OR_LATER, PY27, _basestring
label_desc: Use image node_id 2 for calling a global function with example usage: _detect_compressor(fileobj) and returns: str, str, str, str, str, str, str