def _launch_instance(self):
metadata = {'<STR_LIT:key>': '<STR_LIT>', '<STR_LIT:value>': self.ssh_public_key}<EOL>self.running_instance_id = ipa_utils.generate_instance_name(<EOL>'<STR_LIT>'<EOL>)<EOL>self.logger.debug('<STR_LIT>' % self.running_instance_id)<EOL>kwargs = {<EOL>'<STR_LIT:location>': self.region,<EOL>'<STR_LIT>': metadata,<EOL>'<STR_LIT>': [{<EOL>'<STR_LIT:email>': self.service_account_email,<EOL>'<STR_LIT>': ['<STR_LIT>']<EOL>}]<EOL>}<EOL>if self.subnet_id:<EOL><INDENT>kwargs['<STR_LIT>'] = self._get_subnet(self.subnet_id)<EOL>kwargs['<STR_LIT>'] = kwargs['<STR_LIT>'].network<EOL><DEDENT>try:<EOL><INDENT>instance = self.compute_driver.create_node(<EOL>self.running_instance_id,<EOL>self.instance_type or GCE_DEFAULT_TYPE,<EOL>self.image_id,<EOL>**kwargs<EOL>)<EOL><DEDENT>except ResourceNotFoundError as error:<EOL><INDENT>try:<EOL><INDENT>message = error.value['<STR_LIT:message>']<EOL><DEDENT>except TypeError:<EOL><INDENT>message = error<EOL><DEDENT>raise GCECloudException(<EOL>'<STR_LIT>'.format(<EOL>message=message<EOL>)<EOL>)<EOL><DEDENT>self.compute_driver.wait_until_running(<EOL>[instance],<EOL>timeout=self.timeout<EOL>)<EOL>
Launch an instance of the given image.