def paginate(client, paginator, **kwargs):
    """
    Returns pages for given AWS paginator client and type.
    Example: iam client and "list_policies" paginator
    """
    marker = None
    while True:
        pages = client.get_paginator(paginator).paginate(**kwargs,
            PaginationConfig={'MaxItems': 10, 'PageSize': 10,
            'StartingToken': marker})
        for page in pages:
            yield page
        if 'NextMarker' not in page:
            break
        marker = page['NextMarker']
