def update_progress(values, print_function=None, prefix_text='', bar_len=40):
    """
    Creates a process bar in ASCII


    >>> for x in update_progress(range(1, 65), prefix_text="Prefix text: "):
    Prefix text: [########] 20.31%

    :param values: list or generator with items to process
    :type values: list

    :param print_function: function used to display information. By default is buildin 'print'.
    :type print_function: function

    :param prefix_text: Text to write before bar.
    :type prefix_text: str

    :param bar_len: number of characters used into bar.
    :type bar_len: int

    """
    _values = list(values)
    _len_values = len(_values)
    _var_len = bar_len
    _print = print_function or print
    for i, x in enumerate(_values, start=1):
        _percent = i / _len_values
        _percent_fix = int(i / _len_values * _var_len)
        _print('\r{0} [#{1}] {2:.2f}%'.format(prefix_text, '#' *
            _percent_fix, _percent * 100), end='')
        yield x
