Parse a string as time indices.

  Args:
    s: A valid slicing string for time indices. E.g., '-1', '[:]', ':', '2:10'

  Returns:
    A slice object.

  Raises:
    ValueError: If `s` does not represent valid time indices.

def parse_time_indices(s):
  """Parse a string as time indices.

  Args:
    s: A valid slicing string for time indices. E.g., '-1', '[:]', ':', '2:10'

  Returns:
    A slice object.

  Raises:
    ValueError: If `s` does not represent valid time indices.
  """
  if not s.startswith('['):
    s = '[' + s + ']'
  parsed = command_parser._parse_slices(s)
  if len(parsed) != 1:
    raise ValueError(
        'Invalid number of slicing objects in time indices (%d)' % len(parsed))
  else:
    return parsed[0]