def upload(self, bucket_name, object_name, filename,<EOL>mime_type='<STR_LIT>', gzip=False):
if gzip:<EOL><INDENT>filename_gz = filename + '<STR_LIT>'<EOL>with open(filename, '<STR_LIT:rb>') as f_in:<EOL><INDENT>with gz.open(filename_gz, '<STR_LIT:wb>') as f_out:<EOL><INDENT>shutil.copyfileobj(f_in, f_out)<EOL>filename = filename_gz<EOL><DEDENT><DEDENT><DEDENT>client = self.get_conn()<EOL>bucket = client.get_bucket(bucket_name=bucket_name)<EOL>blob = bucket.blob(blob_name=object_name)<EOL>blob.upload_from_filename(filename=filename,<EOL>content_type=mime_type)<EOL>if gzip:<EOL><INDENT>os.remove(filename)<EOL><DEDENT>self.log.info('<STR_LIT>', filename, object_name, bucket_name)<EOL>
Uploads a local file to Google Cloud Storage.

:param bucket_name: The bucket to upload to.
:type bucket_name: str
:param object_name: The object name to set when uploading the local file.
:type object_name: str
:param filename: The local file path to the file to be uploaded.
:type filename: str
:param mime_type: The MIME type to set when uploading the file.
:type mime_type: str
:param gzip: Option to compress file for upload
:type gzip: bool