def get_old_and_new_values(change_type, message):
    values_map = {
        'assigned_to': 'users',
        'status': 'status',
        'severity': 'severity',
        'priority': 'priority',
        'milestone': 'milestone',
        'type': 'type',
        'user_story': 'user_story'
    }

    if change_type in ['subject', 'name', 'estimated_finish', 'estimated_start']:
        old = message["change"]["diff"][change_type]["from"]
        new = message["change"]["diff"][change_type]["to"]
        return old, new

    try:
        old_id = message["change"]["diff"][change_type]["from"]
        old = message["change"]["values"][values_map[change_type]][str(old_id)]
    except KeyError:
        old = None

    try:
        new_id = message["change"]["diff"][change_type]["to"]
        new = message["change"]["values"][values_map[change_type]][str(new_id)]
    except KeyError:
        new = None

    return old, new
Parses the payload and finds previous and current value of change_type.
dataset/ETHPy150Open zulip/zulip/zerver/views/webhooks/taiga.py/get_old_and_new_values