code: def _construct_graph_from_file(cls, f, format=None, *args, **kwds):
      """Unified reading function for graphs.
  
      This method tries to identify the format of the graph given in
      the first parameter and calls the corresponding reader method.
  
      The remaining arguments are passed to the reader method without
      any changes.
  
      @param f: the file containing the graph to be loaded
      @param format: the format of the file (if known in advance).
        C{None} means auto-detection. Possible values are: C{"ncol"}
        (NCOL format), C{"lgl"} (LGL format), C{"graphdb"} (GraphDB
        format), C{"graphml"}, C{"graphmlz"} (GraphML and gzipped
        GraphML format), C{"gml"} (GML format), C{"net"}, C{"pajek"}
        (Pajek format), C{"dimacs"} (DIMACS format), C{"edgelist"},
        C{"edges"} or C{"edge"} (edge list), C{"adjacency"}
        (adjacency matrix), C{"dl"} (DL format used by UCINET),
        C{"pickle"} (Python pickled format),
        C{"picklez"} (gzipped Python pickled format)
      @raises IOError: if the file format can't be identified and
        none was given.
      """
      if isinstance(f, os.PathLike):
          f = str(f)
      if format is None:
          format = _identify_format(f)
      try:
          reader = cls._format_mapping[format][0]
      except (KeyError, IndexError):
          raise IOError(
              "unknown file format: %s" % str(format)
          ) from None
      if reader is None:
          raise IOError(
              "no reader method for file format: %s" % str(format)
          )
      reader = getattr(cls, reader)
      return reader(f, *args, **kwds)
  
file_path: python-igraph/src/igraph/io/files.py
imports: import gzip
  import os
  from shutil import copyfileobj
  from warnings import warn
  from igraph._igraph import GraphBase
  from igraph.utils import named_temporary_file
label_desc: Use image node_id 7 for calling a global function with example usage: _construct_graph_from_file(cls, f, format) and returns: reader