code: def download(self, packageName, versionCode=None, offerType=1, expansion_files=False):
          
  
          if self.authSubToken is None:
              raise LoginError("You need to login before executing any request")
  
          if versionCode is None:
              # pick up latest version
              appDetails = self.details(packageName).get('details').get('appDetails')
              versionCode = appDetails.get('versionCode')
  
          headers = self.getHeaders()
          params = {'ot': str(offerType),
                    'doc': packageName,
                    'vc': str(versionCode)}
          self.log(packageName)
          response = requests.post(PURCHASE_URL, headers=headers,
                                   params=params, verify=ssl_verify,
                                   timeout=60,
                                   proxies=self.proxies_config)
  
          response = googleplay_pb2.ResponseWrapper.FromString(response.content)
          if response.commands.displayErrorMessage != "":
              raise RequestError(response.commands.displayErrorMessage)
          else:
              dlToken = response.payload.buyResponse.downloadToken
              return self.delivery(packageName, versionCode, offerType, dlToken,
                                   expansion_files=expansion_files)
docs: Download an app and return its raw data (APK file). Free apps need
          to be "purchased" first, in order to retrieve the download cookie.
          If you want to download an already purchased app, use *delivery* method.
  
          Args:
              packageName (str): app unique ID (usually starting with 'com.')
              versionCode (int): version to download
              offerType (int): different type of downloads (mostly unused for apks)
              downloadToken (str): download token returned by 'purchase' API
              progress_bar (bool): wether or not to print a progress bar to stdout
  
          Returns
              Dictionary containing apk data and optional expansion files
              (see *delivery*)