<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stop_gradient(input_layer):
 """Cuts off the gradient at this point. This works on both sequence and regular Pretty Tensors. Args: input_layer: The input. Returns: A new Pretty Tensor of the same type with stop_gradient applied. """

  if input_layer.is_sequence():
    result = [tf.stop_gradient(t) for t in input_layer.sequence]
    return input_layer.with_sequence(result)
  else:
    return tf.stop_gradient(input_layer)