def ignore_task(username, title, reason, ttl):
    # type: (str, str, str, timedelta) -> None
    '''
    Adds a task with the given title to the ignore list for the given
    amount of time. Additionally adds an optional message to specify the
    reason that the alert was ignored.

    Args:
        username (str): The username of the user to ignore the given alert for.
        title (str): The title of the alert to ignore.
        ttl (Timedelta): The amount of time to ignore the alert for.
        msg (str): An optional string specifying why an alert was ignored
    '''
    expiry_time = datetime.now(tz=pytz.utc) + ttl
    # NB: Non-standard MySQL specific query
    SQLEngine.execute('''INSERT INTO ignored (ldap, title, reason, until)
    VALUES (%s, %s, %s, %s)
    ON DUPLICATE KEY UPDATE reason=VALUES(reason), until=VALUES(until)
    ''', (username, title, reason, expiry_time.strftime('%Y-%m-%d %H:%M:%S')))
Adds a task with the given title to the ignore list for the given
amount of time. Additionally adds an optional message to specify the
reason that the alert was ignored.

Args:
username (str): The username of the user to ignore the given alert for.
title (str): The title of the alert to ignore.
ttl (Timedelta): The amount of time to ignore the alert for.
msg (str): An optional string specifying why an alert was ignored
securitybot/ignored_alerts.py