def validate_args(args):
  """Validate and return command line arguments."""
  if (args.first is None) ^ (args.last is None):
    raise Exception('`first` and `last` must be used together')
  if args.first and args.first > args.last:
    raise Exception('`first` must be less than or equal to `last`')
  return args.first, args.last, args.test