'Constructor.
Args:
prop: the name of the prop by which to sort.
direction: the direction in which to sort the given prop.
Raises:
datastore_errors.BadArgumentError if the prop name or direction is
invalid.'

def __init__(self, prop, direction=ASCENDING):

    datastore_types.ValidateString(prop, 'prop', datastore_errors.BadArgumentError)
    if (not (direction in self._DIRECTIONS)):
        raise datastore_errors.BadArgumentError(('unknown    direction:    %r' % (direction,)))
    super(PropertyOrder, self).__init__()
    self.__order = datastore_pb.Query_Order()
    self.__order.set_property(prop.encode('utf-8'))
    self.__order.set_direction(direction)
