'Wait for the initial SSL handshake to complete.
If a ``callback`` is given, it will be called with no
arguments once the handshake is complete; otherwise this
method returns a `.Future` which will resolve to the
stream itself after the handshake is complete.
Once the handshake is complete, information such as
the peer\'s certificate and NPN/ALPN selections may be
accessed on ``self.socket``.
This method is intended for use on server-side streams
or after using `IOStream.start_tls`; it should not be used
with `IOStream.connect` (which already waits for the
handshake to complete). It may only be called once per stream.
.. versionadded:: 4.2'

def wait_for_handshake(self, callback=None):

    if ((self._ssl_connect_callback is not None) or (self._ssl_connect_future is not None)):
        raise RuntimeError('Already    waiting')
    if (callback is not None):
        self._ssl_connect_callback = stack_context.wrap(callback)
        future = None
    else:
        future = self._ssl_connect_future = TracebackFuture()
    if (not self._ssl_accepting):
        self._run_ssl_connect_callback()
    return future
