def _get_element_from_list_with_delay(item_list, element, delay):
    """
    A little util for faking delay of data stream. e.g.
    ```
    l = []
    get = generate_delay(l, 3)

    for i in range(10):
        print get(i)
    ```
    prints
    0 0 0 1 2 3 4 5 6

    :param item_list list: list of items
    :param element object: Just any python object
    :param delay int: how many items to delay by
    :return: a function that fakes a delay data stream, see above
    """
    item_list.append(element)
    if len(item_list) > delay:
        return item_list.pop(0)
    else:
        return item_list[0]