#NEWLINE# def ensure_database( self , database_name ) : #NEWLINE# #INDENT# "\n        Creates the database if it does not exist.\n\n        :param database_name: Database to create.\n        :type database_name: :class:`str`\n        :return: Whether the database had to be created or not.\n        :rtype: :class:`bool`\n\n        Example:\n        ::\n\n            class MySampleRole(Role):\n                def provision(self):\n                    with self.using(MySQLRole) as role:\n                        role.ensure_database('database')\n        " #NEWLINE# if ( not self . is_database_present ( database_name ) ) : #NEWLINE# #INDENT# self . __execute_non_query ( ( 'CREATE DATABASE %s' % database_name ) ) #NEWLINE# self . log ( ( 'Database %s not found. Database created!' % self ) ) #NEWLINE# return True #NEWLINE# #UNINDENT# return False