def _convert_priority(p_priority):
    """
    Converts todo.txt priority to an iCalendar priority (RFC 2445).

    Priority A gets priority 1, priority B gets priority 5 and priority C-F get
    priorities 6-9. This scheme makes sure that clients that use "high",
    "medium" and "low" show the correct priority.
    """
    result = 0
    prio_map = {'A': 1, 'B': 5, 'C': 6, 'D': 7, 'E': 8, 'F': 9}
    try:
        result = prio_map[p_priority]
    except KeyError:
        if p_priority:
            result = 9
    return result
