async def __stop_server(self) -> None:
    log.debug('asking server %r to close', self.server)
    if (self.server is not None):
        self.server.close()
    log.debug('waiting for server to close')
    if ((self.loop is not None) and (self.server is not None)):
        (await self.loop.create_task(self.server.wait_closed()))
    log.debug('stopping loop')
    if (self.loop is not None):
        log.debug('Pending tasks at stop: %r', all_tasks(self.loop))
        self.loop.stop()
async def __stop_server(self) -> None:
    log.debug('asking server %r to close', self.server)
    if (self.server is not None):
        self.server.close()
    log.debug('waiting for server to close')
    if ((self.loop is not None) and (self.server is not None)):
        (await self.loop.create_task(self.server.wait_closed()))
    log.debug('stopping loop')
    if (self.loop is not None):
        log.debug('Pending tasks at stop: %r', all_tasks(self.loop))
        self.loop.stop()