def split_role(r):
    """
    Given a string R that may be suffixed with a number, returns a
    tuple (ROLE, NUM) where ROLE+NUM == R and NUM is the maximal
    suffix of R consisting only of digits.
    """
    i = len(r)
    while i > 1 and r[i - 1].isdigit():
        i -= 1
    return r[:i], r[i:]