code: def zip_process(**kwargs):
      str_localPath   = ""
      str_zipFileName = ""
      str_action      = "zip"
      str_arcroot     = ""
      for k,v in kwargs.items():
          if k == 'path':             str_localPath   = v
          if k == 'action':           str_action      = v
          if k == 'payloadFile':      str_zipFileName = v
          if k == 'arcroot':          str_arcroot     = v
      if str_action       == 'zip':
          str_mode        = 'w'
          str_zipFileName = '%s.zip' % uuid.uuid4()
      else:
          str_mode        = 'r'
      try:
          ziphandler          = zipfile.ZipFile(str_zipFileName, str_mode, zipfile.ZIP_DEFLATED)
          if str_mode == 'w':
              if os.path.isdir(str_localPath):
                  zipdir(str_localPath, ziphandler, arcroot = str_arcroot)
              else:
                  if len(str_arcroot):
                      str_arcname = str_arcroot.split('/')[-1] + str_localPath.split(str_arcroot)[1]
                  else:
                      str_arcname = str_localPath
                  try:
                      ziphandler.write(str_localPath, arcname = str_arcname)
                  except:
                      ziphandler.close()
                      os.remove(str_zipFileName)
                      return {
                          'msg':      json.dumps({"msg": "No file or directory found for '%s'" % str_localPath}),
                          'status':   False
                      }
          if str_mode     == 'r':
              ziphandler.extractall(str_localPath)
          ziphandler.close()
          str_msg             = '%s operation successful' % str_action
          b_status            = True
      except:
          str_msg             = '%s operation failed'     % str_action
          b_status            = False
      return {
          'msg':              str_msg,
          'fileProcessed':    str_zipFileName,
          'status':           b_status,
          'path':             str_localPath,
          'zipmode':          str_mode,
          'filesize':         "{:,}".format(os.stat(str_zipFileName).st_size),
          'timestamp':        '%s' % datetime.datetime.now()
      }