def _get_entities(kind, namespace, order, start, count):
 query = datastore.Query(kind, _namespace=namespace)
 if order:
  if order.startswith('-'):
   direction = datastore.Query.DESCENDING
   order = order[1:]
  else:
   direction = datastore.Query.ASCENDING
  query.Order((order, direction))
 total = query.Count()
 entities = query.Get(count, start)
 return (entities, total)

def _get_entities ( kind , namespace , order , start , count ) : query = datastore . Query ( kind , _namespace = namespace ) if order : if order . startswith ( '-' ) : direction = datastore . Query . DESCENDING order = order [ 1 : ] else : direction = datastore . Query . ASCENDING query . Order ( ( order , direction ) ) total = query . Count ( ) entities = query . Get ( count , start ) return ( entities , total )
returns a list and a count of entities of the given kind .