# Buggy code
def update_persistence(self, update=None):
    """Update :attr:`user_data`, :attr:`chat_data` and :attr:`bot_data` in :attr:`persistence`.

    Args:
        update (:class:`telegram.Update`, optional): The update to process. If passed, only the
        corresponding ``user_data`` and ``chat_data`` will be updated.
    """
    if self.persistence:
        chat_ids = self.chat_data.keys()
        user_ids = self.user_data.keys()

        if isinstance(update, Update):
            if update.effective_chat:
                chat_ids = [update.effective_chat.id]
            else:
                chat_ids = []
            if update.effective_user:
                user_ids = [update.effective_user.id]
            else:
                user_ids = []

        if self.persistence.store_bot_data:
            try:
                self.persistence.update_bot_data(self.bot_data)
            except Exception as e:
                try:
                    self.dispatch_error(update, e)
                except Exception:
                    message = (
                        "Saving bot data raised an error and an "
                        "uncaught error was raised while handling "
                        "the error with an error_handler"
                    )
                    self.logger.exception(message)
        if self.persistence.store_chat_data:
            for chat_id in chat_ids:
                try:
                    self.persistence.update_chat_data(chat_id, self.chat_data[chat_id])
                except Exception as e:
                    try:
                        self.dispatch_error(update, e)
                    except Exception:
                        message = (
                            "Saving chat data raised an error and an "
                            "uncaught error was raised while handling "
                            "the error with an error_handler"
                        )
                        self.logger.exception(message)
        if self.persistence.store_user_data:
            for user_id in user_ids:
                try:
                    self.persistence.update_user_data(user_id, self.user_data[user_id])
                except Exception as e:
                    try:
                        self.dispatch_error(update, e)
                    except Exception:
                        message = (
                            "Saving user data raised an error and an "
                            "uncaught error was raised while handling "
                            "the error with an error_handler"
                        )
                        self.logger.exception(message)


# Traceback (telegram.error.BadRequest)
<project_path>/venv/bin/python <project_path>/issue.py
2017-06-20 23:24:11,743 - __main__ - INFO - /start
2017-06-20 23:24:11,906 - telegram.ext.dispatcher - WARNING - A TelegramError was raised while processing the Update.
2017-06-20 23:24:11,907 - __main__ - ERROR - Boom!
2017-06-20 23:24:11,907 - __main__ - INFO - /async_start
2017-06-20 23:24:12,188 - telegram.utils.promise - ERROR - An uncaught error was raised while running the promise
Traceback (most recent call last):
File "<project_path>/venv/src/python-telegram-bot/telegram/utils/promise.py", line 42, in run
self._result = self.pooled_function(*self.args, **self.kwargs)
File "<project_path>/issue.py", line 25, in action_async_start
update.message.reply_text(msg, parse_mode=ParseMode.HTML)
File "<project_path>/venv/src/python-telegram-bot/telegram/message.py", line 340, in reply_text
return self.bot.send_message(self.chat_id, *args, **kwargs)
File "<project_path>/venv/src/python-telegram-bot/telegram/bot.py", line 125, in decorator
result = func(self, *args, **kwargs)
File "<project_path>/venv/src/python-telegram-bot/telegram/bot.py", line 158, in decorator
return Bot._message_wrapper(self, url, data, *args, **kwargs)
File "<project_path>/venv/src/python-telegram-bot/telegram/bot.py", line 146, in _message_wrapper
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "<project_path>/venv/src/python-telegram-bot/telegram/utils/request.py", line 252, in post
**urlopen_kwargs)
File "<project_path>/venv/src/python-telegram-bot/telegram/utils/request.py", line 194, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Can't parse entities in message text: unsupported start tag "invalid_tag" at byte offset 0

Process finished with exit code 0

# Fixed code
def update_persistence(self, update=None):
    """Update :attr:`user_data`, :attr:`chat_data` and :attr:`bot_data` in :attr:`persistence`.

    Args:
        update (:class:`telegram.Update`, optional): The update to process. If passed, only the
        corresponding ``user_data`` and ``chat_data`` will be updated.
    """
    with self._update_persistence_lock:
        self.__update_persistence(update)