code: def upload_file(self, url, file, callback=None, extra_headers={}):
          
          extra_headers = extra_headers.copy()
          response = None
          if os.stat(file.name).st_size == 0:
              raise CommError("%s is an empty file" % file.name)
          try:
              progress = Progress(file, callback=callback)
              response = requests.put(
                  url, data=progress, headers=extra_headers)
              response.raise_for_status()
          except requests.exceptions.RequestException as e:
              total = progress.len
              status = self._status_request(url, total)
              # TODO(adrian): there's probably even more stuff we should add here
              # like if we're offline, we should retry then too
              if status.status_code in (308, 408, 500, 502, 503, 504):
                  util.sentry_reraise(retry.TransientException(exc=e))
              else:
                  util.sentry_reraise(e)
  
          return response
docs: Uploads a file to W&B with failure resumption
  
          Args:
              url (str): The url to download
              file (str): The path to the file you want to upload
              callback (:obj:`func`, optional): A callback which is passed the number of
              bytes uploaded since the last time it was called, used to report progress
  
          Returns:
              The requests library response object