code: def size_printer(display_name, size):
      sz = [0]
      last_stamp = [dt.datetime.now()]
  
      def printer(chunk):
          sz[0] += len(chunk)
          now = dt.datetime.now()
          if last_stamp[0] + dt.timedelta(seconds=10) < now:
              if size:
                  print >> sys.stderr, "##status##{} - [[imp]]{:.1f}%[[rst]]".format(
                      display_name, 100.0 * sz[0] / size if size else 0
                  )
              last_stamp[0] = now
  
      return printer
  
imports: import datetime
  import errno
  import hashlib
  import json
  import logging
  import os
  import platform
  import random
  import shutil
  import socket
  import string
  import sys
  import tarfile
  import urllib2
  import retry
label_desc: Use image node_id 13 for calling a global function with example usage: size_printer(display_name, size) and returns: printer