code: def select_module(module_name, type_str, lookup_table=None):
      """
      This function first tries to find the absolute module name
      by matching the static dictionary items, if not found, it
      tries to import the module by splitting the input ``module_name``
      as module name and class name to be imported.
  
      :param module_name: string that matches the keys defined in lookup_table
          or an absolute class name: module.name.ClassName
      :param type_str: type of the module (used for better error display)
      :param lookup_table: defines a set of shorthands for absolute class name
      """
      lookup_table = lookup_table or {}
      module_name = "{}".format(module_name)
      is_external = True
      if module_name in lookup_table:
          module_name = lookup_table[module_name]
          is_external = False
      module_str, class_name = None, None
      try:
          module_str, class_name = module_name.rsplit(".", 1)
          the_module = importlib.import_module(module_str)
          the_class = getattr(the_module, class_name)
          if is_external:
              # print location of external module
              tf.logging.info(
                  "Import [%s] from %s.",
                  class_name,
                  os.path.abspath(the_module.__file__),
              )
          return the_class
      except (AttributeError, ValueError, ImportError) as not_imported:
          tf.logging.fatal(repr(not_imported))
          if "." not in module_name:
              err = (
                  "Could not import {}: "
                  'Incorrect module name "{}"; '
                  'expected "module.object".'.format(
                      type_str, module_name
                  )
              )
          else:
              err = (
                  "{}: Could not import object"
                  '"{}" from "{}"'.format(
                      type_str, class_name, module_str
                  )
              )
          tf.logging.fatal(err)
  
          if not lookup_table:
              # no further guess
              raise ValueError(err)
  
          dists = dict(
              (k, edit_distance(k, module_name))
              for k in list(lookup_table)
          )
          closest = min(dists, key=dists.get)
          if dists[closest] <= 3:
              err = (
                  'Could not import {2}: By "{0}", '
                  'did you mean "{1}"?\n "{0}" is '
                  "not a valid option. ".format(
                      module_name, closest, type_str
                  )
              )
              tf.logging.fatal(err)
          raise ValueError(err)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import importlib
  import os
  import tensorflow
  from niftynet.utilities.util_common import damerau_levenshtein_distance
label_desc: Use image node_id 1 for calling a global function with example usage: select_module(module_name, type_str, lookup_table) and returns: the_class