code: def _map_or_apply(input_layer, op, *args, **kwargs):
    
    # Name is special because it can also set the name scope.
    kwargs.pop('name')
    right = kwargs.pop('right_', False)
    if input_layer.is_sequence():
      if right:
        args += (input_layer,)
      else:
        args = ((input_layer,) + args)
      result = [op(*x, **kwargs) for x in _zip_with_scalars(args)]
      if len(result) != len(input_layer):
        raise ValueError('Not all arguments were the same length.')
      return result
    else:
      if right:
        my_op = lambda x: op(*(args + (x,)), **kwargs)
      else:
        my_op = lambda x: op(x, *args, **kwargs)
      return my_op(input_layer.tensor)
docs: Map op across the input if it is a sequence; otherwise apply it.
  
    Note: This takes a keyword argument `right_` to right apply the op to this
    input. The name is chosen to limit conflicts with other keyword arguments.
  
    Args:
      input_layer: The input_layer (self when chaining).
      op: The op to apply:
      *args: Positional arguments for op; if input is a list then any iterable is
        treated as an argument to co-map (i.e. it zips across non-scalars).
      **kwargs: Keyword arguments for op; note that `right_` is used by this
        function.
    Returns:
      A new Pretty Tensor that is the result of applying the op to every internal
      Tensor.
    Raises:
      ValueError: If a sequence argument is not the same length as the
        input_layer.