code: def get_constraint_fn(fn_name="NonNeg"):
      """Returns a constraint function.
  
      .. role:: python(code)
         :language: python
  
      The function must follow the signature:
      :python:`w_ = constraint_fn(w)`.
  
      Args:
          fn_name (str or callable): The name or full path to a
              constraint function, or the function itself.
  
              The function can be:
  
              - Built-in constraint functions defined in modules \
              :tf_main:`tf.keras.constraints <keras/constraints>` \
              (e.g., :tf_main:`NonNeg <keras/constraints/NonNeg>`) \
              or :tf_main:`tf < >` or :tf_main:`tf.nn <nn>` \
              (e.g., activation functions).
              - User-defined function in :mod:`texar.tf.custom`.
              - Externally defined function. Must provide the full path, \
              e.g., `"my_module.my_constraint_fn"`.
  
              If a callable is provided, then it is returned directly.
  
      Returns:
          The constraint function. `None` if :attr:`fn_name` is `None`.
      """
      if fn_name is None:
          return None
  
      fn_modules = [
          "tensorflow.keras.constraints",
          "tensorflow",
          "tensorflow.nn",
          "texar.tf.custom",
      ]
      constraint_fn = utils.get_function(fn_name, fn_modules)
      return constraint_fn
  
imports: import copy
  import tensorflow
  import tensorflow.contrib.rnn
  from texar.tf.hyperparams import HParams
  from texar.tf.utils import utils
  from texar.tf.utils.dtypes import is_str
  from texar.tf.utils.variables import add_variable
  from texar.tf.utils.mode import is_train_mode, switch_dropout
label_desc: Use image node_id 8 for calling a global function with example usage: get_constraint_fn(fn_name) and returns: constraint_fn, None