code: def get_read_format(cls, source, args, kwargs):
      
      ctx = None
      if isinstance(source, FILE_LIKE):
          fileobj = source
          filepath = source.name if hasattr(source, 'name') else None
      else:
          filepath = source
          try:
              ctx = get_readable_fileobj(filepath, encoding='binary')
              fileobj = ctx.__enter__()  # pylint: disable=no-member
          except IOError:
              raise
          except Exception:  # pylint: disable=broad-except
              fileobj = None
      try:
          return get_format('read', cls, filepath, fileobj, args, kwargs)
      finally:
          if ctx is not None:
              ctx.__exit__(*sys.exc_info())
docs: Determine the read format for a given input source