#NEWLINE# def insert_folder( self , title , parent_id ) : #NEWLINE# #INDENT# 'Insert new folder.\n\n        Args:\n          service: Drive API service instance.\n          title: Title of the folder to insert, including the extension.\n          parent_id: Parent folder id\n          permissions: List of permissions\n        Returns:\n          Inserted file metadata if successful, None otherwise.\n        ' #NEWLINE# body = { #NEWLINE# #INDENT# 'title' : body , #NEWLINE# 'mimeType' : 'application/vnd.google-apps.folder' , #NEWLINE# #UNINDENT# } #NEWLINE# if parent_id : #NEWLINE# #INDENT# body [ 'parents' ] = [ { #NEWLINE# #INDENT# 'id' : parent_id , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# folder = self . _service . files ( ) . insert ( body = body ) . execute ( ) #NEWLINE# return folder #NEWLINE# #UNINDENT# except errors . HttpError : #NEWLINE# #INDENT# logger . exception ( 'An error while creating a folder.' ) #NEWLINE# return None