code: def get_nnp(contents, tmpdir, need_file_object, file_type):
      import io
      from nnabla.utils.save import save
      from nnabla.utils import nnp_graph
  
      if file_type == ".nntxt" or file_type == ".prototxt":
          include_params = True
      else:
          include_params = False
  
      if need_file_object:
          nnp_object = (
              io.BytesIO() if file_type == ".nnp" else io.StringIO()
          )
          save(
              nnp_object,
              contents,
              extension=file_type,
              include_params=include_params,
          )
          nnp_object.seek(0)
          nnp = nnp_graph.NnpLoader(nnp_object, extension=file_type)
      else:
          tmpdir.ensure(dir=True)
          nnp_file = tmpdir.join("tmp" + file_type).strpath
          save(nnp_file, contents, include_params=include_params)
          nnp = nnp_graph.NnpLoader(nnp_file)
      return nnp
  
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  import nnabla.parametric_functions
  from nnabla.testing import assert_allclose
  from helper import get_saved_test_model, forward_variable_and_check_equal, forward_variable, assert_topology, dump_network_topology
  import legacy_nnp_graph
  from nnabla.utils import nnp_graph
label_desc: Use image node_id 19 for calling a global function with example usage: get_nnp(contents, tmpdir, need_file_object, file_type) and returns: nnp