code: def get_file_handle_load(path, ext):
      if ext == ".nnp":
          need_close = True
          f = zipfile.ZipFile(path, "r")
      elif ext == ".h5":
          need_close = True
          if isinstance(path, str):
              f = h5py.File(path, "r")
          else:
              f = h5py.File(io.BytesIO(path.read()), "r")
      elif ext in [".nntxt", ".prototxt"]:
          if hasattr(path, "read"):
              need_close = False
              f = path
          else:
              need_close = True
              f = open(path, "r")
      elif ext == ".protobuf":
          if hasattr(path, "read"):
              need_close = False
              f = path
          else:
              need_close = True
              f = open(path, "rb")
      else:
          raise ValueError(
              "Currently, ext == {} is not support".format(ext)
          )
  
      yield f
      if need_close:
          f.close()
  
imports: import contextlib
  import zipfile
  import h5py
  import io
label_desc: Use image node_id 1 for calling a global function with example usage: get_file_handle_load(path, ext) without return types