def parse_hex(text):
    """Parse a hex number from text or fail

    :param text: Text to parse hex number from
    :type text: str

    :return: Parsed hex number
    :rtype: int
    :raise RuntimeError: If text does not contain a valid hexadecimal number
    """
    try:
        return int(text, 0)
    except ValueError as ex:
        raise RuntimeError(f"Could not parse hex number '{text}': {ex}")