code: def get_function(fn_or_name, module_paths=None):
      """Returns the function of specified name and module.
  
      Args:
          fn_or_name (str or callable): Name or full path to a function, or the
              function itself.
          module_paths (list, optional): A list of paths to candidate modules to
              search for the function. This is used only when the function
              cannot be located solely based on :attr:`fn_or_name`. The first
              module in the list that contains the function is used.
  
      Returns:
          A function.
      """
      if is_callable(fn_or_name):
          return fn_or_name
  
      fn = locate(fn_or_name)
      if (fn is None) and (module_paths is not None):
          for module_path in module_paths:
              # if module_path in _unimportable_modules:
              fn = locate(".".join([module_path, fn_or_name]))
              if fn is not None:
                  break
              # module = importlib.import_module(module_path)
              # if fn_name in dir(module):
              #    fn = getattr(module, fn_name)
              #    break
  
      if fn is None:
          raise ValueError(
              "Method not found in {}: {}".format(
                  module_paths, fn_or_name
              )
          )
  
      return fn
  
imports: from typing import List, Union
  import inspect
  import funcsigs
  from pydoc import locate
  import copy
  import collections
  import numpy
  import tensorflow
  from texar.tf.hyperparams import HParams
  from texar.tf.utils.dtypes import is_str, is_callable, compat_as_text, _maybe_list_to_array
label_desc: Use image node_id 11 for calling a global function with example usage: get_function(fn_or_name, module_paths) and returns: fn, fn_or_name