def _getendingnumber(string):
    """
    Helper function to extract the last number of a string

    Args:
        string (str): A .awg field name, like SEQUENCE_JUMP_23

    Returns
        (int, str): The number and the shortened string,
          e.g. 'SEQUENCE_JUMP_23' -> (23, 'SEQUENCE_JUMP_')
    """

    num = ''

    for char in string[::-1]:
        if char.isdigit():
            num += char
        else:
            break

    return (int(num[::-1]), string[:-len(num)])