code: def _function_with_backend(
      func, unique_api_name, preferred_device=None
  ):
      function_attributes = {
          _FUNCTION_API_NAME_ATTRIBUTE: unique_api_name
      }
      if preferred_device:
          function_attributes[
              _FUNCTION_DEVICE_ATTRIBUTE
          ] = preferred_device
      return tf.function(
          func,
          autograph=False,
          experimental_attributes=function_attributes,
      )
  
imports: import functools
  import uuid
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling a global function with example usage: _function_with_backend(func, unique_api_name, preferred_device) and returns: tf