code: def guess_io_type(obj):
      
      if obj is None:
          return IOI_NONE
      if anyconfig.utils.is_path(obj):
          return IOI_PATH_STR
      if anyconfig.utils.is_path_obj(obj):
          return IOI_PATH_OBJ
      if anyconfig.utils.is_file_stream(obj):
          return IOI_STREAM
  
      raise ValueError("Unknown I/O type object: %r" % obj)
docs: Guess input or output type of 'obj'.
  
      :param obj: a path string, a pathlib.Path or a file / file-like object
      :return: IOInfo type defined in anyconfig.globals.IOI_TYPES
  
      >>> apath = "/path/to/a_conf.ext"
      >>> assert guess_io_type(apath) == IOI_PATH_STR
  
      >>> from anyconfig.compat import pathlib
      >>> if pathlib is not None:
      ...     assert guess_io_type(pathlib.Path(apath)) == IOI_PATH_OBJ
      >>> assert guess_io_type(open(__file__)) == IOI_STREAM
      >>> guess_io_type(1)  # doctest: +ELLIPSIS
      Traceback (most recent call last):
          ...
      ValueError: ...