code: def maybe_download(filename, work_directory, source_url):
      if not os.path.exists(work_directory):
          mkpath(work_directory)
      filepath = os.path.join(work_directory, filename)
  
      if not os.path.exists(filepath):
          print("Downloading data from", source_url)
          global progbar
          progbar = None
  
          def dl_progress(count, block_size, total_size):
              global progbar
              if progbar is None:
                  progbar = Progbar(total_size)
              else:
                  progbar.update(count * block_size)
  
          with tempfile.NamedTemporaryFile() as tmpfile:
              temp_file_name = tmpfile.name
              urlretrieve(source_url, temp_file_name, dl_progress)
              shutil.copy2(temp_file_name, filepath)
              size = os.path.getsize(filepath)
              print("Successfully downloaded", filename, size, "bytes.")
      return filepath
  
file_path: BigDL/python/dllib/src/bigdl/dllib/feature/dataset/base.py
imports: import os
  import sys
  import shutil
  import tempfile
  import time
  from distutils.dir_util import mkpath
  from six.moves.urllib.request import urlopen
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: maybe_download(filename, work_directory, source_url) and returns: filepath