code: def _padded(t, lhs, rhs=None):
      """Left pads and optionally right pads the innermost axis of `t`."""
      lhs = tf.convert_to_tensor(lhs, dtype=t.dtype)
      zeros = tf.zeros([tf.rank(t) - 1, 2], dtype=tf.int32)
      lhs_paddings = tf.concat([zeros, [[1, 0]]], axis=0)
      result = tf.pad(t, paddings=lhs_paddings, constant_values=lhs)
      if rhs is not None:
          rhs = tf.convert_to_tensor(rhs, dtype=t.dtype)
          rhs_paddings = tf.concat([zeros, [[0, 1]]], axis=0)
          result = tf.pad(
              result, paddings=rhs_paddings, constant_values=rhs
          )
      return result
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 2 for calling a global function with example usage: _padded(t, lhs, rhs) and returns: result