code: def str2act(act):
      if len(act) > 5 and act[0:5] == "lrelu":
          try:
              alpha = float(act[5:])
              return lambda x: tf.nn.leaky_relu(x, alpha=alpha)
          except Exception as e:
              raise Exception(
                  "{} can not be parsed as a float".format(act[5:])
              )
  
      if len(act) > 10 and act[0:10] == "leaky_relu":
          try:
              alpha = float(act[10:])
              return lambda x: tf.nn.leaky_relu(x, alpha=alpha)
          except Exception as e:
              raise Exception(
                  "{} can not be parsed as a float".format(act[10:])
              )
  
      if act not in _act_dict.keys():
          raise Exception("Unsupported act: {}".format(act))
      return _act_dict[act]
  
imports: import inspect
  from abc import abstractmethod
  import tensorflow
  import tensorlayer
  from tensorlayer import logging
  from tensorlayer.decorators import deprecated_alias, private_method, protected_method
  from tensorlayer.files import utils
  from tensorlayer.layers.utils import get_variable_with_initializer, list_remove_repeat
label_desc: Use image node_id 1 for calling a global function with example usage: str2act(act) and returns: _act_dict, function, function