def _get_descending_key(gettime=time.time, getrandint=random.randint):
  """Returns a key name lexically ordered by time descending.

  This lets us have a key name for use with Datastore entities which returns
  rows in time descending order when it is scanned in lexically ascending order,
  allowing us to bypass index building for descending indexes.

  Args:
    gettime: Used for testing.
    getrandint: Used for testing.

  Returns:
    A string with a time descending key.
  """
  now_descending = int((_FUTURE_TIME - gettime()) * 100)
  tie_breaker = getrandint(0, 100)
  return "%d%d" % (now_descending, tie_breaker)
Returns a key name lexically ordered by time descending.

  This lets us have a key name for use with Datastore entities which returns
  rows in time descending order when it is scanned in lexically ascending order,
  allowing us to bypass index building for descending indexes.

  Args:
    gettime: Used for testing.
    getrandint: Used for testing.

  Returns:
    A string with a time descending key.
  
mapreduce/model.py