def order(self, *args):
<EOL>if not args:<EOL><INDENT>return self<EOL><DEDENT>orders = []<EOL>o = self.orders<EOL>if o:<EOL><INDENT>orders.append(o)<EOL><DEDENT>for arg in args:<EOL><INDENT>if isinstance(arg, model.Property):<EOL><INDENT>orders.append(datastore_query.PropertyOrder(arg._name, _ASC))<EOL><DEDENT>elif isinstance(arg, datastore_query.Order):<EOL><INDENT>orders.append(arg)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>' % arg)<EOL><DEDENT><DEDENT>if not orders:<EOL><INDENT>orders = None<EOL><DEDENT>elif len(orders) == <NUM_LIT:1>:<EOL><INDENT>orders = orders[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>orders = datastore_query.CompositeOrder(orders)<EOL><DEDENT>return self.__class__(kind=self.kind, ancestor=self.ancestor,<EOL>filters=self.filters, orders=orders,<EOL>app=self.app, namespace=self.namespace,<EOL>default_options=self.default_options,<EOL>projection=self.projection, group_by=self.group_by)<EOL>
Return a new Query with additional sort order(s) applied.