def enumerate_iter(iterator, end='END', max_it=None):
    """
    Function enumerating iterator with limit

    Parameters
    ----------
    iterator : iterator
        iterator for iterating
    end : str
        indicator of end of iterator
    max_it: int
        max number of iterations
    Returns
    -------
    generator
        generated enumerated elements
    """
    ct = 0
    iterate = True
    while iterate:
        try:
            yield ct, next(iterator)
        except StopIteration:
            iterate = False
            yield ct, end
        ct += 1
        if max_it and ct >= max_it:
            iterate = False
