code: def importorskip(modname, minversion=None, reason=None):
      """Imports and returns the requested module ``modname``, or skip the current test
      if the module cannot be imported.
  
      :param str modname: the name of the module to import
      :param str minversion: if given, the imported module ``__version__`` attribute must be
          at least this minimal version, otherwise the test is still skipped.
      :param str reason: if given, this reason is shown as the message when the module
          cannot be imported.
      """
      import warnings
  
      __tracebackhide__ = True
      compile(modname, "", "eval")  # to catch syntaxerrors
      import_exc = None
  
      with warnings.catch_warnings():
          # make sure to ignore ImportWarnings that might happen because
          # of existing directories with the same name we're trying to
          # import but without a __init__.py file
          warnings.simplefilter("ignore")
          try:
              __import__(modname)
          except ImportError as exc:
              # Do not raise chained exception here(#1485)
              import_exc = exc
      if import_exc:
          if reason is None:
              reason = "could not import %r: %s" % (modname, import_exc)
          raise Skipped(reason, allow_module_level=True)
      mod = sys.modules[modname]
      if minversion is None:
          return mod
      verattr = getattr(mod, "__version__", None)
      if minversion is not None:
          if verattr is None or Version(verattr) < Version(minversion):
              raise Skipped(
                  "module %r has __version__ %r, required is: %r"
                  % (modname, verattr, minversion),
                  allow_module_level=True,
              )
      return mod
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  from packaging.version import Version
label_desc: Use image node_id 5 for calling a global function with example usage: importorskip(modname, minversion, reason) and returns: mod, mod