Collects at most 500 Twitter lists for each user from an input list of Twitter user ids.

    Inputs: - twitter_app_key: What is says on the tin.
            - twitter_app_secret: Ditto.
            - user_id_list: A python list of Twitter user ids.

    Yields: - user_twitter_id: A Twitter user id.
            - twitter_lists_list: A python list containing Twitter lists in dictionary (json) format.

def fetch_twitter_lists_for_user_ids_generator(twitter_app_key,
                                               twitter_app_secret,
                                               user_id_list):
    """
    Collects at most 500 Twitter lists for each user from an input list of Twitter user ids.

    Inputs: - twitter_app_key: What is says on the tin.
            - twitter_app_secret: Ditto.
            - user_id_list: A python list of Twitter user ids.

    Yields: - user_twitter_id: A Twitter user id.
            - twitter_lists_list: A python list containing Twitter lists in dictionary (json) format.
    """
    ####################################################################################################################
    # Log into my application.
    ####################################################################################################################
    twitter = login(twitter_app_key,
                    twitter_app_secret)

    ####################################################################################################################
    # For each user, gather at most 500 Twitter lists.
    ####################################################################################################################
    get_list_memberships_counter = 0
    get_list_memberships_time_window_start = time.perf_counter()
    for user_twitter_id in user_id_list:
        # Make safe twitter request.
        try:
            twitter_lists_list, get_list_memberships_counter, get_list_memberships_time_window_start\
                = safe_twitter_request_handler(twitter_api_func=twitter.get_list_memberships,
                                               call_rate_limit=15,
                                               call_counter=get_list_memberships_counter,
                                               time_window_start=get_list_memberships_time_window_start,
                                               max_retries=5,
                                               wait_period=2,
                                               user_id=user_twitter_id,
                                               count=500,
                                               cursor=-1)
            # If the call is succesful, yield the list of Twitter lists.
            yield user_twitter_id, twitter_lists_list
        except twython.TwythonError:
            # If the call is unsuccesful, we do not have any Twitter lists to store.
            yield user_twitter_id, None
        except URLError:
            # If the call is unsuccesful, we do not have any Twitter lists to store.
            yield user_twitter_id, None
        except BadStatusLine:
            # If the call is unsuccesful, we do not have any Twitter lists to store.
            yield user_twitter_id, None