<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query(self, table_name, index_name=None, consistent_read=None, key_condition_expression=None, filter_expression=None, expression_attribute_names=None, expression_attribute_values=None, projection_expression=None, select=None, exclusive_start_key=None, limit=None, scan_index_forward=True, return_consumed_capacity=None):
 """A `Query`_ operation uses the primary key of a table or a secondary index to directly access items from that table or index. :param str table_name: The name of the table containing the requested items. :param bool consistent_read: Determines the read consistency model: If set to ``True``, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads. Strongly consistent reads are not supported on global secondary indexes. If you query a global secondary index with ``consistent_read`` set to ``True``, you will receive a :exc:`~sprockets_dynamodb.exceptions.ValidationException`. :param dict exclusive_start_key: The primary key of the first item that this operation will evaluate. Use the value that was returned for ``LastEvaluatedKey`` in the previous operation. In a parallel scan, a *Scan* request that includes ``exclusive_start_key`` must specify the same segment whose previous *Scan* returned the corresponding value of ``LastEvaluatedKey``. :param dict expression_attribute_names: One or more substitution tokens for attribute names in an expression. :param dict expression_attribute_values: One or more values that can be substituted in an expression. :param str key_condition_expression: The condition that specifies the key value(s) for items to be retrieved by the *Query* action. The condition must perform an equality test on a single partition key value, but can optionally perform one of several comparison tests on a single sort key value. The partition key equality test is required. For examples see `KeyConditionExpression <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ Query.html#Query.KeyConditionExpressions>. :param str filter_expression: A string that contains conditions that DynamoDB applies after the *Query* operation, but before the data is returned to you. Items that do not satisfy the criteria are not returned. Note that a filter expression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units. For more information, see `Filter Expressions <http://docs.aws.amazon.com/amazondynamodb/ latest/developerguide/QueryAndScan.html#FilteringResults>`_ in the Amazon DynamoDB Developer Guide. :param str projection_expression: :param str index_name: The name of a secondary index to query. This index can be any local secondary index or global secondary index. Note that if you use this parameter, you must also provide ``table_name``. :param int limit: The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in ``LastEvaluatedKey`` to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in ``LastEvaluatedKey`` to apply in a subsequent operation to continue the operation. For more information, see `Query and Scan <http://docs.aws.amazon.com/amazo ndynamodb/latest/developerguide/QueryAndScan.html>`_ in the Amazon DynamoDB Developer Guide. :param str return_consumed_capacity: Determines the level of detail about provisioned throughput consumption that is returned in the response: - ``INDEXES``: The response includes the aggregate consumed capacity for the operation, together with consumed capacity for each table and secondary index that was accessed. Note that some operations, such as *GetItem* and *BatchGetItem*, do not access any indexes at all. In these cases, specifying ``INDEXES`` will only return consumed capacity information for table(s). - ``TOTAL``: The response includes only the aggregate consumed capacity for the operation. - ``NONE``: No consumed capacity details are included in the response. :param bool scan_index_forward: Specifies the order for index traversal: If ``True`` (default), the traversal is performed in ascending order; if ``False``, the traversal is performed in descending order. Items with the same partition key value are stored in sorted order by sort key. If the sort key data type is *Number*, the results are stored in numeric order. For type *String*, the results are stored in order of ASCII character code values. For type *Binary*, DynamoDB treats each byte of the binary data as unsigned. If set to ``True``, DynamoDB returns the results in the order in which they are stored (by sort key value). This is the default behavior. If set to ``False``, DynamoDB reads the results in reverse order by sort key value, and then returns the results to the client. :param str select: The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index. Possible values are: - ``ALL_ATTRIBUTES``: Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required. - ``ALL_PROJECTED_ATTRIBUTES``: Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifying ``ALL_ATTRIBUTES``. - ``COUNT``: Returns the number of matching items, rather than the matching items themselves. :rtype: dict .. _Query: http://docs.aws.amazon.com/amazondynamodb/ latest/APIReference/API_Query.html """

        payload = {'TableName': table_name,
                   'ScanIndexForward': scan_index_forward}
        if index_name:
            payload['IndexName'] = index_name
        if consistent_read is not None:
            payload['ConsistentRead'] = consistent_read
        if key_condition_expression:
            payload['KeyConditionExpression'] = key_condition_expression
        if filter_expression:
            payload['FilterExpression'] = filter_expression
        if expression_attribute_names:
            payload['ExpressionAttributeNames'] = expression_attribute_names
        if expression_attribute_values:
            payload['ExpressionAttributeValues'] = \
                utils.marshall(expression_attribute_values)
        if projection_expression:
            payload['ProjectionExpression'] = projection_expression
        if select:
            _validate_select(select)
            payload['Select'] = select
        if exclusive_start_key:
            payload['ExclusiveStartKey'] = utils.marshall(exclusive_start_key)
        if limit:
            payload['Limit'] = limit
        if return_consumed_capacity:
            _validate_return_consumed_capacity(return_consumed_capacity)
            payload['ReturnConsumedCapacity'] = return_consumed_capacity
        return self.execute('Query', payload)