code: def upload_to_s3(self, key, filename):
          
          extra_args = {'ACL': self.acl}
          # determine the mimetype of the file
          guess = mimetypes.guess_type(filename)
          content_type = guess[0]
          encoding = guess[1]
  
          if content_type:
              extra_args['ContentType'] = content_type
  
          # add the gzip headers, if necessary
          if (self.gzip and content_type in self.gzip_content_types) or encoding == 'gzip':
              extra_args['ContentEncoding'] = 'gzip'
  
          # add the cache-control headers if necessary
          if content_type in self.cache_control:
              extra_args['CacheControl'] = ''.join((
                  'max-age=',
                  str(self.cache_control[content_type])
              ))
  
          # access and write the contents from the file
          if not self.dry_run:
              logger.debug("Uploading %s" % filename)
              if self.verbosity > 0:
                  self.stdout.write("Uploading %s" % filename)
              s3_obj = self.s3_resource.Object(self.aws_bucket_name, key)
              s3_obj.upload_file(filename, ExtraArgs=extra_args)
  
          # Update counts
          self.uploaded_files += 1
          self.uploaded_file_list.append(filename)
docs: Set the content type and gzip headers if applicable
          and upload the item to S3