def quote_identifier(identifier: str,
                     mixed: Union[SQLCompiler, Engine, Dialect]) -> str:
    """
    Converts an SQL identifier to a quoted version, via the SQL dialect in
    use.

    Args:
        identifier: the identifier to be quoted
        mixed: an SQLAlchemy :class:`SQLCompiler`, :class:`Engine`, or
            :class:`Dialect` object

    Returns:
        the quoted identifier

    """
    # See also http://sqlalchemy-utils.readthedocs.io/en/latest/_modules/sqlalchemy_utils/functions/orm.html  # noqa
    return get_preparer(mixed).quote(identifier)