def ensure_started(self):
<EOL>if self.state in ['<STR_LIT>', '<STR_LIT:error>']:<EOL><INDENT>self._wait_for_state_change(['<STR_LIT>', '<STR_LIT>'])<EOL><DEDENT>if self.state == '<STR_LIT>':<EOL><INDENT>self.start()<EOL>self._wait_for_state_change(['<STR_LIT>'])<EOL><DEDENT>if self.state == '<STR_LIT>':<EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>' + self.state)<EOL><DEDENT>
Start a server and waits (blocking wait) until it is fully started.