# Buggy code
def _start_webhook(
    self,
    listen,
    port,
    url_path,
    cert,
    key,
    bootstrap_retries,
    clean,
    webhook_url,
    allowed_updates,
):
    self.logger.debug("Updater thread started (webhook)")
    use_ssl = cert is not None and key is not None
    if not url_path.startswith("/"):
        url_path = "/{}".format(url_path)

    # Create Tornado app instance
    app = WebhookAppClass(
        url_path, self.bot, self.update_queue, default_quote=self._default_quote
    )

    # Form SSL Context
    # An SSLError is raised if the private key does not match with the certificate
    if use_ssl:
        try:
            ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
            ssl_ctx.load_cert_chain(cert, key)
        except ssl.SSLError:
            raise TelegramError("Invalid SSL Certificate")
    else:
        ssl_ctx = None

    # Create and start server
    self.httpd = WebhookServer(listen, port, app, ssl_ctx)

    if use_ssl:
        # DO NOT CHANGE: Only set webhook if SSL is handled by library
        if not webhook_url:
            webhook_url = self._gen_webhook_url(listen, port, url_path)

        self._bootstrap(
            max_retries=bootstrap_retries,
            clean=clean,
            webhook_url=webhook_url,
            cert=open(cert, "rb"),
            allowed_updates=allowed_updates,
        )
    elif clean:
        self.logger.warning(
            "cleaning updates is not supported if "
            "SSL-termination happens elsewhere; skipping"
        )

    self.httpd.serve_forever()


# Traceback (NotImplementedError)
Exception in thread Bot:377489430:updater:
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Program Files\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\User\.virtualenvs\sandbox38\lib\site-packages\telegram\ext\updater.py", line 216, in _thread_wrapper
target(*args, **kwargs)
File "C:\Users\User\.virtualenvs\sandbox38\lib\site-packages\telegram\ext\updater.py", line 452, in _start_webhook
self.httpd.serve_forever()
File "C:\Users\User\.virtualenvs\sandbox38\lib\site-packages\telegram\utils\webhookhandler.py", line 52, in serve_forever
self.http_server.listen(self.port, address=self.listen)
File "C:\Users\User\.virtualenvs\sandbox38\lib\site-packages\tornado\tcpserver.py", line 152, in listen
self.add_sockets(sockets)
File "C:\Users\User\.virtualenvs\sandbox38\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "C:\Users\User\.virtualenvs\sandbox38\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "C:\Users\User\.virtualenvs\sandbox38\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Program Files\Python38\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError

# Fixed code
def _start_webhook(
    self,
    listen,
    port,
    url_path,
    cert,
    key,
    bootstrap_retries,
    clean,
    webhook_url,
    allowed_updates,
    ready=None,
    force_event_loop=False,
):
    self.logger.debug("Updater thread started (webhook)")
    use_ssl = cert is not None and key is not None
    if not url_path.startswith("/"):
        url_path = "/{}".format(url_path)

    # Create Tornado app instance
    app = WebhookAppClass(
        url_path, self.bot, self.update_queue, default_quote=self._default_quote
    )

    # Form SSL Context
    # An SSLError is raised if the private key does not match with the certificate
    if use_ssl:
        try:
            ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
            ssl_ctx.load_cert_chain(cert, key)
        except ssl.SSLError:
            raise TelegramError("Invalid SSL Certificate")
    else:
        ssl_ctx = None

    # Create and start server
    self.httpd = WebhookServer(listen, port, app, ssl_ctx)

    if use_ssl:
        # DO NOT CHANGE: Only set webhook if SSL is handled by library
        if not webhook_url:
            webhook_url = self._gen_webhook_url(listen, port, url_path)

        self._bootstrap(
            max_retries=bootstrap_retries,
            clean=clean,
            webhook_url=webhook_url,
            cert=open(cert, "rb"),
            allowed_updates=allowed_updates,
        )
    elif clean:
        self.logger.warning(
            "cleaning updates is not supported if "
            "SSL-termination happens elsewhere; skipping"
        )

    self.httpd.serve_forever(force_event_loop=force_event_loop, ready=ready)