def _paginated_scan(ddb_table, filter_exp=None):
    """performs a paginated scan of the DynamoDB table
    """
    if filter_exp:
        response = ddb_table.scan(FilterExpression=filter_exp)
    else:
        response = ddb_table.scan()
    data = response['Items']
    print(len(data))

    while response.get('LastEvaluatedKey'):
        response = ddb_table.scan(ExclusiveStartKey=response['LastEvaluatedKey'])
        addl_data = response['Items']
        print(len(addl_data))
        data.extend(addl_data)

    return {'Items': data, 'Count': len(data)}