def bar(iter_content, parts, title=''):
    """ Iterates over the "iter_content" and draws a progress bar to stdout.
    """
    parts = max(float(parts), 1.0)
    cells = 10
    progress = 0
    step = cells / parts

    draw = lambda progress: sys.stdout.write(
        '\r[{0:10}] {1:.2f}% {2}'.format(
            '#'*int(progress), progress * cells, title))

    for chunk in iter_content:
        yield chunk

        progress += step
        draw(progress)
        sys.stdout.flush()

    draw(cells)
    print('')
Iterates over the "iter_content" and draws a progress bar to stdout.