code: def download(self, path, chunksize=None, chunk_callback=lambda _: False):
          
          chunksize = chunksize or self.chunksize
          bucket, obj = self._path_to_bucket_and_key(path)
  
          with tempfile.NamedTemporaryFile(delete=False) as fp:
              # We can't return the tempfile reference because of a bug in python: http://bugs.python.org/issue18879
              return_fp = _DeleteOnCloseFile(fp.name, 'r')
  
              # Special case empty files because chunk-based downloading doesn't work.
              result = self.client.objects().get(bucket=bucket, object=obj).execute()
              if int(result['size']) == 0:
                  return return_fp
  
              request = self.client.objects().get_media(bucket=bucket, object=obj)
              downloader = http.MediaIoBaseDownload(fp, request, chunksize=chunksize)
  
              attempts = 0
              done = False
              while not done:
                  error = None
                  try:
                      _, done = downloader.next_chunk()
                      if chunk_callback(fp):
                          done = True
                  except errors.HttpError as err:
                      error = err
                      if err.resp.status < 500:
                          raise
                      logger.warning('Error downloading file, retrying', exc_info=True)
                  except RETRYABLE_ERRORS as err:
                      logger.warning('Error downloading file, retrying', exc_info=True)
                      error = err
  
                  if error:
                      attempts += 1
                      if attempts >= NUM_RETRIES:
                          raise error
                  else:
                      attempts = 0
  
          return return_fp
docs: Downloads the object contents to local file system.
  
          Optionally stops after the first chunk for which chunk_callback returns True.