import re


def sanitize_user_identified_syntax(msg):
    """
    Captures variations of the ALTER/CREATE USER...IDENTIFIED... syntax.
    See: https://mariadb.com/kb/en/library/alter-user/
    """
    if "ALTER USER" in msg.upper() or "CREATE USER" in msg.upper():
        msg = re.sub(r"BY .*('|\")", 'BY ***', msg, flags=re.IGNORECASE)
        msg = re.sub(r"USING .*('|\")", 'USING ***', msg, flags=re.IGNORECASE)
        msg = re.sub(r"AS .*('|\")", 'AS ***', msg, flags=re.IGNORECASE)
    return msg