import os
import Queue
import threading
import sys
import urllib3
from .settings import PROGRESS_FORMATTER, NUM_THREADS


pool_manager = urllib3.PoolManager()
photo_queue = Queue.Queue()
lock = threading.Lock()


def parallel_download(photos, user, size, outdir):
    print('Parallel downloading photos from %s: %d' % (user, len(photos)))
    threads = []
    # Put photos into `photo_queue`
    for photo in photos:
        photo_queue.put(photo)

    thread_pool = [
        threading.Thread(
            target=worker,
            args=(photo_queue, user, size, outdir, len(photos))
        ) for i in range(NUM_THREADS)
    ]

    for t in thread_pool:
        threads.append(t)
        t.start()

    for t in threads:
        t.join()


def worker(queue, user, size, outdir, total):
    while True:
        try:
            photo = queue.get(False)
        except Queue.Empty:
            break
        media_url = photo[1]
        urllib3_download(media_url, size, outdir)
        with lock:
            d = {
                'media_url': os.path.basename(media_url),
                'user': user,
                'index': total - photo_queue.qsize(),
                'total': total,
            }
            progress = PROGRESS_FORMATTER % d
            sys.stdout.write('\r%s' % progress)
            sys.stdout.flush()


def urllib3_download(media_url, size, outdir):
    r = pool_manager.request('GET', media_url + ':' + size)
    bs = os.path.basename(media_url)
    filename = os.path.join(outdir or '', bs)
    with open(filename, 'wb') as fd:
        fd.write(r.data)
    return filename

@@ -261,83 +261,8 @@
 r):%0A
-    print('Parallel downloading photos from %25s: %25d' %25 (user, len(photos)))%0A
     

Remove unnessary print