human
Here's a good function header given the following:
I wrote the below code

    def BadRequest(message):
        '    Exception    raised    if    there    was    a    bad    request.    '
        raise apiproxy_errors.ApplicationError(datastore_pb.Error.BAD_REQUEST, message)
    key_prop_name = datastore_types._KEY_SPECIAL_PROPERTY
    unapplied_log_timestamp_us_name = datastore_types._UNAPPLIED_LOG_TIMESTAMP_SPECIAL_PROPERTY
    if query.has_transaction():
        if (not query.has_ancestor()):
            BadRequest('Only    ancestor    queries    are    allowed    inside    transactions.')
    num_components = (len(filters) + len(orders))
    if query.has_ancestor():
        num_components += 1
    if (num_components > max_query_components):
        BadRequest(('query    is    too    large.    may    not    have    more    than    %s    filters    +    sort    orders    ancestor    total' % max_query_components))
    if query.has_ancestor():
        ancestor = query.ancestor()
        if (query.app() != ancestor.app()):
            BadRequest(('query    app    is    %s    but    ancestor    app    is    %s' % (query.app(), ancestor.app())))
        if (query.name_space() != ancestor.name_space()):
            BadRequest(('query    namespace    is    %s    but    ancestor    namespace    is    %s' % (query.name_space(), ancestor.name_space())))
    ineq_prop_name = None
    for filter in filters:
        if (filter.property_size() != 1):
            BadRequest(('Filter    has    %d    properties,    expected    1' % filter.property_size()))
        prop = filter.property(0)
        prop_name = prop.name().decode('utf-8')
        if (prop_name == key_prop_name):
            if (not prop.value().has_referencevalue()):
                BadRequest(('%s    filter    value    must    be    a    Key' % key_prop_name))
            ref_val = prop.value().referencevalue()
            if (ref_val.app() != query.app()):
                BadRequest(('%s    filter    app    is    %s    but    query    app    is    %s' % (key_prop_name, ref_val.app(), query.app())))
            if...

What's a good function header?
assistant
#Here's a good function header.

def ValidateQuery(query, filters, orders, max_query_components):