def decode_number(num):
    """
    Decodes numbers found in app.xml.

    They are of the formats "U:" (undefined), "V:" (void/none?), or
    "I:<integer>". Returns None if the number is undefined ("U:") or
    an empty string. Raises an exception if the format is otherwise
    invalid.
    """
    if num == "" or num == "U:":
        return None
    elif num == "V:": # "void?" use for pointer and unsized arrays
        return 0
    elif num[0:2] == "I:":
        try:
            return int(num[2:])
        except ValueError:
            raise ValueError("Failed to decode (%s) as a number" % num)
    else:
        raise ValueError("Invalid encoded number (%s)" % num)