def convert_table_name(connection, name):
    """Convert a table name to a format required by the database backend.

    The conversion may result in quoting or otherwise altering the table name.

    This provides compatibility with all supported versions of Django.

    Args:
        connection (object):
            The database connection.

        name (unicode):
            The table name to convert.

    Returns:
        unicode:
        The converted table name.
    """
    introspection = connection.introspection

    if hasattr(introspection, 'identifier_converter'):
        # Django >= 2.2
        return introspection.identifier_converter(name)
    else:
        # Django < 2.2
        return introspection.table_name_converter(name)