# Buggy code
def start_webhook(
    self,
    listen="127.0.0.1",
    port=80,
    url_path="",
    cert=None,
    key=None,
    clean=False,
    bootstrap_retries=0,
    webhook_url=None,
):
    """
    Starts a small http server to listen for updates via webhook. If cert
    and key are not provided, the webhook will be started directly on
    http://listen:port/url_path, so SSL can be handled by another
    application. Else, the webhook will be started on
    https://listen:port/url_path

    Args:
        listen (Optional[str]): IP-Address to listen on
        port (Optional[int]): Port the bot should be listening on
        url_path (Optional[str]): Path inside url
        cert (Optional[str]): Path to the SSL certificate file
        key (Optional[str]): Path to the SSL key file
        clean (Optional[bool]): Whether to clean any pending updates on
            Telegram servers before actually starting the webhook. Default
            is False.
        bootstrap_retries (Optional[int[): Whether the bootstrapping phase
            of the `Updater` will retry on failures on the Telegram server.

            |   < 0 - retry indefinitely
            |   0 - no retries (default)
            |   > 0 - retry up to X times
        webhook_url (Optional[str]): Explicitly specifiy the webhook url.
            Useful behind NAT, reverse proxy, etc. Default is derived from
            `listen`, `port` & `url_path`.

    Returns:
        Queue: The update queue that can be filled from the main thread

    """
    with self.__lock:
        if not self.running:
            self.running = True
            if clean:
                self._clean_updates()

            # Create & start threads
            (self._init_thread(self.dispatcher.start, "dispatcher"),)
            self._init_thread(
                self._start_webhook,
                "updater",
                listen,
                port,
                url_path,
                cert,
                key,
                bootstrap_retries,
                webhook_url,
            )

            # Return the update queue so the main thread can insert updates
            return self.update_queue


# Traceback (telegram.error.NetworkError)
Traceback (most recent call last):
File "main.py", line 43, in <module>
main()
File "main.py", line 34, in main
updates = bot.getUpdates()
File "/usr/local/lib/python3.5/site-packages/telegram/bot.py", line 114, in decorator
result = func(self, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/telegram/bot.py", line 1315, in getUpdates
result = request.post(url, data, timeout=urlopen_timeout)
File "/usr/local/lib/python3.5/site-packages/telegram/utils/request.py", line 83, in decorator
raise NetworkError('URLError: {0}'.format(error.reason))
telegram.error.NetworkError: URLError: _ssl.c:629: The handshake operation timed out

# Fixed code
def start_webhook(
    self,
    listen="127.0.0.1",
    port=80,
    url_path="",
    cert=None,
    key=None,
    clean=False,
    bootstrap_retries=0,
    webhook_url=None,
):
    """
    Starts a small http server to listen for updates via webhook. If cert
    and key are not provided, the webhook will be started directly on
    http://listen:port/url_path, so SSL can be handled by another
    application. Else, the webhook will be started on
    https://listen:port/url_path

    Args:
        listen (Optional[str]): IP-Address to listen on
        port (Optional[int]): Port the bot should be listening on
        url_path (Optional[str]): Path inside url
        cert (Optional[str]): Path to the SSL certificate file
        key (Optional[str]): Path to the SSL key file
        clean (Optional[bool]): Whether to clean any pending updates on
            Telegram servers before actually starting the webhook. Default
            is False.
        bootstrap_retries (Optional[int[): Whether the bootstrapping phase
            of the `Updater` will retry on failures on the Telegram server.

            |   < 0 - retry indefinitely
            |   0 - no retries (default)
            |   > 0 - retry up to X times
        webhook_url (Optional[str]): Explicitly specifiy the webhook url.
            Useful behind NAT, reverse proxy, etc. Default is derived from
            `listen`, `port` & `url_path`.

    Returns:
        Queue: The update queue that can be filled from the main thread

    """
    with self.__lock:
        if not self.running:
            self.running = True

            # Create & start threads
            (self._init_thread(self.dispatcher.start, "dispatcher"),)
            self._init_thread(
                self._start_webhook,
                "updater",
                listen,
                port,
                url_path,
                cert,
                key,
                bootstrap_retries,
                clean,
                webhook_url,
            )

            # Return the update queue so the main thread can insert updates
            return self.update_queue