def _parse_exception(e):
    """Parses an exception, returns its message."""
    import re
    matches = re.search(
        '^\\(_mysql_exceptions\\.OperationalError\\) \\(\\d+, \\"(.+)\\"\\)$',
        str(e))
    if matches:
        return matches.group(1)
    matches = re.search('^\\(psycopg2\\.OperationalError\\) (.+)$', str(e))
    if matches:
        return matches.group(1)
    matches = re.search('^\\(sqlite3\\.OperationalError\\) (.+)$', str(e))
    if matches:
        return matches.group(1)
    return str(e)
