def start_server(self, event=None, server=None):
if server is None:<EOL><INDENT>server = ServerInterface()<EOL><DEDENT>self.server_mode = True<EOL>self.server_object = server<EOL>self.active = True<EOL>if event is not None:<EOL><INDENT>self.completion_event = event<EOL>self.start()<EOL>return<EOL><DEDENT>self.completion_event = event = threading.Event()<EOL>self.start()<EOL>while True:<EOL><INDENT>event.wait(<NUM_LIT:0.1>)<EOL>if not self.active:<EOL><INDENT>e = self.get_exception()<EOL>if e is not None:<EOL><INDENT>raise e<EOL><DEDENT>raise SSHException("<STR_LIT>")<EOL><DEDENT>if event.is_set():<EOL><INDENT>break<EOL><DEDENT><DEDENT>
Negotiate a new SSH2 session as a server.  This is the first step after
creating a new `.Transport` and setting up your server host key(s).  A
separate thread is created for protocol negotiation.

If an event is passed in, this method returns immediately.  When
negotiation is done (successful or not), the given ``Event`` will
be triggered.  On failure, `is_active` will return ``False``.

(Since 1.4) If ``event`` is ``None``, this method will not return until
negotiation is done.  On success, the method returns normally.
Otherwise an SSHException is raised.

After a successful negotiation, the client will need to authenticate.
Override the methods `get_allowed_auths
<.ServerInterface.get_allowed_auths>`, `check_auth_none
<.ServerInterface.check_auth_none>`, `check_auth_password
<.ServerInterface.check_auth_password>`, and `check_auth_publickey
<.ServerInterface.check_auth_publickey>` in the given ``server`` object
to control the authentication process.

After a successful authentication, the client should request to open a
channel.  Override `check_channel_request
<.ServerInterface.check_channel_request>` in the given ``server``
object to allow channels to be opened.

.. note::
    After calling this method (or `start_client` or `connect`), you
    should no longer directly read from or write to the original socket
    object.

:param .threading.Event event:
    an event to trigger when negotiation is complete.
:param .ServerInterface server:
    an object used to perform authentication and create `channels
    <.Channel>`

:raises:
    `.SSHException` -- if negotiation fails (and no ``event`` was
    passed in)