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):
        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)