code: def detect(fp, max_read=1024):
      """Attempt to detect a file's format, trying each of the supported
      formats. Return the format class that was detected. If no format is
      detected, return ``None``.
      """
      if not is_filelike(fp):
          return None
      for Format in _registry.values():
          if Format.detect(fp.read(max_read)):
              fp.seek(0)
              return Format
          fp.seek(0)
      return None
  
imports: from __future__ import absolute_import
  import json
  from collections import OrderedDict
  from textblob.compat import PY2, csv
  from textblob.utils import is_filelike
label_desc: Use image node_id 1 for calling a global function with example usage: detect(fp, max_read) and returns: None, None, Format