code: def get_file_handle_load(nnp, path, ext):
      if nnp is None:
          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)
              )
  
          try:
              yield f
          finally:
              if need_close:
                  f.close()
      else:
          if ext in [".h5"]:
              # if nnp is not None and extension is .h5
              # we assume to return a .h5 type file handler
              with nnp.open(path, "r") as n:
                  f = h5py.File(io.BytesIO(n.read()), "r")
                  yield f
          else:
              f = nnp.open(path, "r")
              try:
                  yield f
              finally:
                  f.close()
  
imports: import contextlib
  import io
  import os
  import re
  import zipfile
  from collections import OrderedDict
  from functools import partial
  import google.protobuf.text_format
  import h5py
  import nnabla
  import numpy
  from nnabla.logger import logger
  from nnabla.utils import nnabla_pb2
  from nnabla.utils.nnp_format import nnp_version
label_desc: Use image node_id 1 for calling a global function with example usage: get_file_handle_load(nnp, path, ext) without return types