code: def collective_manager_ids_from_op(op):
      """Returns CollectiveManager ID from the op if one exists, else None.
  
      CollectiveManager adds collective and no_op operations tagged with an ID,
      unique to the manager object. This function extracts that ID, or None, if the
      node was not generated by a CollectiveManager.
  
      Args:
        op: `Operation` to get the collective manager ID from.
  
      Returns:
        List of CollectiveManager IDs used by the op.
      """
      if op.type == "CollectiveReduce":
          try:
              return [op.get_attr("_collective_manager_id")]
          except ValueError:
              pass
      elif op.type == "StatefulPartitionedCall":
          try:
              return op.get_attr(utils.COLLECTIVE_MANAGER_IDS)
          except ValueError:
              pass
      return []
  
imports: import collections
  import enum
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.framework import auto_control_deps_utils
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import op_def_registry
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import registry
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import control_flow_util
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.util import nest
  from tensorflow.python.util import object_identity
  from tensorflow.python.util import tf_decorator
label_desc: Use image node_id 2 for calling a global function with example usage: collective_manager_ids_from_op(op) and returns: list, list, op