def paginator(*args):
    """
    Generator to paginate over api call.

    Api method must accept start_index and list_count parameters.

    :param: callable function to use for pagination
    :param: optionally pass second function that will be used for subsequent pages
    :param: pass all initial values that first callable function accepts, they will be replicated to a second callable
    :returns: Iterable
    """
    if not callable(args[0]):
        raise ValueError('First argument must be a function')
    primary = args[0]
    secondary = args[0]
    args = args[1:]
    if callable(args[0]):
        secondary = args[0]
        args = args[1:]
    import inspect
    primary_parameters = inspect.signature(primary).parameters.keys()
    secondary_parameters = inspect.signature(secondary).parameters.keys()
    primary_kwargs = {}
    secondary_kwargs = {}
    for i, parameter in enumerate(primary_parameters):
        primary_kwargs[parameter] = args[i]
        if parameter in secondary_parameters:
            secondary_kwargs[parameter] = args[i]
    current = primary
    current_kwargs = primary_kwargs
    has_more = True
    while has_more:
        items = current(**current_kwargs)
        for item in items:
            yield item
        has_more = len(items) >= current_kwargs['list_count']
        current = secondary
        current_kwargs = secondary_kwargs
        current_kwargs['start_index'] = current_kwargs['start_index'
            ] + current_kwargs['list_count']
