code: def read_unknown_ntwk(ntwk):
      if not isinstance(ntwk, nx.classes.graph.Graph):
          _, _, ext = split_filename(ntwk)
          if ext == ".pck":
              ntwk = _read_pickle(ntwk)
          elif ext == ".graphml":
              ntwk = nx.read_graphml(ntwk)
      return ntwk
  
imports: import os.path
  import pickle
  import numpy
  import networkx
  from ...None import logging
  from ...utils.filemanip import split_filename
  from ..base import BaseInterface, BaseInterfaceInputSpec, traits, File, TraitedSpec, InputMultiPath, OutputMultiPath, isdefined
  from .base import have_cmp
label_desc: Use image node_id 2 for calling a global function with example usage: read_unknown_ntwk(ntwk) and returns: ntwk