<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def delete_alarms(deployment_id, alert_id=None, metric_name=None, api_key=None, profile='telemetry'):
    '''delete an alert specified by alert_id or if not specified blows away all the alerts
         in the current deployment.

    Returns (bool success, str message) tuple.

    CLI Example:

        salt myminion telemetry.delete_alarms rs-ds033197 profile=telemetry

    '''
    auth = _auth(profile=profile)

    if alert_id is None:
        # Delete all the alarms associated with this deployment
        alert_ids = get_alert_config(deployment_id, api_key=api_key, profile=profile)
    else:
        alert_ids = [alert_id]

    if not alert_ids:
        return False, "failed to find alert associated with deployment: {0}".format(deployment_id)

    failed_to_delete = []
    for id in alert_ids:
        delete_url = _get_telemetry_base(profile) + "/alerts/{0}".format(id)

        try:
            response = requests.delete(delete_url, headers=auth)
            if metric_name:
                log.debug("updating cache and delete %s key from %s",
                          metric_name, deployment_id)
                _update_cache(deployment_id, metric_name, None)

        except requests.exceptions.RequestException as e:
            log.error('Delete failed: %s', e)

        if response.status_code != 200:
            failed_to_delete.append(id)

    if failed_to_delete:
        return False, "Failed to delete {0} alarms in deployment: {1}" .format(', '.join(failed_to_delete), deployment_id)

    return True, "Successfully deleted {0} alerts in deployment: {1}".format(', '.join(alert_ids), deployment_id)