code: def download_arcrest():
  
      
      arcrest_name = "arcrest.zip"
      arcresthelper_name = "arcresthelper.zip"
      url = "https://github.com/Esri/ArcREST/archive/master.zip"
      file_name = os.path.join(arcpy.env.scratchFolder, os.path.basename(url))
      scratch_folder = os.path.join(arcpy.env.scratchFolder, "temp34asdf3d")
      arcrest_zip = os.path.join(scratch_folder, arcrest_name )
      arcresthelper_zip = os.path.join(scratch_folder, arcresthelper_name)
      if sys.version_info.major == 3:
          import urllib.request
          urllib.request.urlretrieve(url, file_name)
      else:
          import urllib
          urllib.urlretrieve(url, file_name)
      if os.path.isdir(scratch_folder):
          shutil.rmtree(scratch_folder)
      os.makedirs(scratch_folder)
      zip_obj = zipfile.ZipFile(file_name, 'r')
      zip_obj.extractall(scratch_folder)
      zip_obj.close()
      del zip_obj
      zip_obj = zipfile.ZipFile(arcrest_zip, 'w')
      zipws(path=os.path.join(scratch_folder, "arcrest-master", "src", "arcrest"), zip=zip_obj, keep=True)
      zip_obj.close()
      del zip_obj
      zip_obj = zipfile.ZipFile(arcresthelper_zip, 'w')
      zipws(path=os.path.join(scratch_folder, "arcrest-master", "src", "arcresthelper"), zip=zip_obj, keep=True)
      zip_obj.close()
      del zip_obj
      shutil.rmtree(os.path.join(scratch_folder, "arcrest-master"))
      return arcrest_zip, arcresthelper_zip
docs: downloads arcrest to disk