def numbered_menu(menutitle,optionlist):
    """
    numbered_menu
    -------------
    Given a menu title string and a list of strings to display as menu items, show a text menu
    with the menu items in a numbered list and ask the user to input a number to indicate their choice. 
    Returns an integer according to the user selection, with the integer value 99 reserved as a
    'back/exit' flag. 
    
    Example: 
    n = numbered_menu('Menu Title',['First option','Second option','Third option'])
    print("You chose option: {0}".format(n))
    
    """
    while True:
        print("{0}".format(menutitle))
        numitems = len(optionlist)
        for i in range(1, numitems+1):
            print("{0}: {1}".format(i,optionlist[i-1]))
        print("")
        try:
            val = int(input("Enter choice or 99 to go back/exit: "))
        except ValueError:
            print("Invalid option - please choose one of the numbered options or 99 to go back/exit")
            continue
        # Test if values in range, or 99 as escape value
        if ((val == 99) or ((val > 0) and (val < numitems+1))):
            break        
        print("Invalid option - please choose one of the numbered options or 99 to go back/exit")
        continue
    return val