def query_all_items(dynamo_resource, table_name, **kwargs):
    """
    Iterate over all the pages in the query result and concatenate them.

    :param dynamo_resource: The DynamoDB resource.
    :type dynamo_resource: DynamoDB
    :param table_name: the table name
    :type table_name: str
    :param kwargs: the query arguments. See Boto3 documentation.
    :return: All items in the table matching the query.
    :rtype: list
    """
    table = dynamo_resource.Table(table_name)
    response = table.query(**kwargs)
    items = response['Items']
    while response.get('LastEvaluatedKey'):
        kwargs['ExclusiveStartKey'] = response['LastEvaluatedKey']
        response = table.query(**kwargs)
        items.extend(response['Items'])
    return items
