code: def underlying_variable_ref(t):
      """Find the underlying variable ref.
      Traverses through Identity, ReadVariableOp, and Enter ops.
      Stops when op type has Variable or VarHandle in name.
      Args:
        t: a Tensor
      Returns:
        a Tensor that is a variable ref, or None on error.
      """
      while t.op.type in ["Identity", "ReadVariableOp", "Enter"]:
          t = t.op.inputs[0]
  
      op_type = t.op.type
      if "Variable" in op_type or "VarHandle" in op_type:
          return t
      else:
          return None
  
file_path: finetune/finetune/optimizers/recompute_grads.py
imports: import functools
  import tensorflow
  from tensorflow.python.framework import function, ops
  from finetune.util.optimize_loss import is_numerical_tensor
label_desc: Use image node_id 4 for calling a global function with example usage: underlying_variable_ref(t) and returns: t, None