code: def deserialize_function(serial, function_type):
      """Deserializes the Keras-serialized function.
  
      (De)serializing Python functions from/to bytecode is unsafe. Therefore we
      also use the function's type as an anonymous function ('lambda') or named
      function in the Python environment ('function'). In the latter case, this lets
      us use the Python scope to obtain the function rather than reload it from
      bytecode. (Note that both cases are brittle!)
  
      Keras-deserialized functions do not perform lexical scoping. Any modules that
      the function requires must be imported within the function itself.
  
      This serialization mimicks the implementation in `tf_keras.layers.Lambda`.
  
      Args:
        serial: Serialized Keras object: typically a dict, string, or bytecode.
        function_type: Python string denoting 'function' or 'lambda'.
  
      Returns:
        function: Function the serialized Keras object represents.
  
      #### Examples
  
      ```python
      serial, function_type = serialize_function(lambda x: x)
      function = deserialize_function(serial, function_type)
      assert function(2.3) == 2.3  # function is identity
      ```
  
      """
      if function_type == "function":
          # Simple lookup in custom objects
          function = tf_keras.utils.legacy.deserialize_keras_object(
              serial
          )
      elif function_type == "lambda":
          # Unsafe deserialization from bytecode
          function = _func_load(serial)
      else:
          raise TypeError("Unknown function type:", function_type)
      return function
  
file_path: probability/tensorflow_probability/python/layers/util.py
imports: import binascii
  import codecs
  import marshal
  import os
  import types
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python import util
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import tf_keras
label_desc: Use image node_id 4 for calling a global function with example usage: deserialize_function(serial, function_type) and returns: function