code: def test_for(item, min_version=None, callback=extract_version):
      """Test to see if item is importable, and optionally check against a minimum
      version.
  
      If min_version is given, the default behavior is to check against the
      `__version__` attribute of the item, but specifying `callback` allows you to
      extract the value you are interested in. e.g::
  
          In [1]: import sys
  
          In [2]: from IPython.testing.iptest import test_for
  
          In [3]: test_for('sys', (2,6), callback=lambda sys: sys.version_info)
          Out[3]: True
  
      """
      try:
          check = import_item(item)
      except (ImportError, RuntimeError):
          # GTK reports Runtime error if it can't be initialized even if it's
          # importable.
          return False
      else:
          if min_version:
              if callback:
                  # extra processing step to get version to compare
                  check = callback(check)
  
              return check >= min_version
          else:
              return True
  
imports: from __future__ import print_function
  import glob
  from io import BytesIO
  import os
  import os.path
  import sys
  from threading import Thread, Lock, Event
  import warnings
  import nose.plugins.builtin
  from nose.plugins.xunit import Xunit
  from nose import SkipTest
  from nose.core import TestProgram
  from nose.plugins import Plugin
  from nose.util import safe_str
  from IPython import version_info
  from IPython.utils.py3compat import bytes_to_str
  from IPython.utils.importstring import import_item
  from IPython.testing.plugin.ipdoctest import IPythonDoctest
  from IPython.external.decorators import KnownFailure, knownfailureif
label_desc: Use image node_id 3 for calling a global function with example usage: test_for(item, min_version, callback) and returns: False, unknown, True