def upload_to_s3(self, key, filename):
extra_args = {'<STR_LIT>': self.acl}<EOL>guess = mimetypes.guess_type(filename)<EOL>content_type = guess[<NUM_LIT:0>]<EOL>encoding = guess[<NUM_LIT:1>]<EOL>if content_type:<EOL><INDENT>extra_args['<STR_LIT>'] = content_type<EOL><DEDENT>if (self.gzip and content_type in self.gzip_content_types) or encoding == '<STR_LIT>':<EOL><INDENT>extra_args['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>if content_type in self.cache_control:<EOL><INDENT>extra_args['<STR_LIT>'] = '<STR_LIT>'.join((<EOL>'<STR_LIT>',<EOL>str(self.cache_control[content_type])<EOL>))<EOL><DEDENT>if not self.dry_run:<EOL><INDENT>logger.debug("<STR_LIT>" % filename)<EOL>if self.verbosity > <NUM_LIT:0>:<EOL><INDENT>self.stdout.write("<STR_LIT>" % filename)<EOL><DEDENT>s3_obj = self.s3_resource.Object(self.aws_bucket_name, key)<EOL>s3_obj.upload_file(filename, ExtraArgs=extra_args)<EOL><DEDENT>self.uploaded_files += <NUM_LIT:1><EOL>self.uploaded_file_list.append(filename)<EOL>
Set the content type and gzip headers if applicable
and upload the item to S3