def METHOD_NAME(value: str, to_type: Callable[[int], W]) -> W:
    """Read a Uint type from a hex string or int"""
    # find the function based on the type
    # if the value is a hex string, convert it
    if isinstance(value, str) and value.startswith("0x"):
        return to_type(int(value[2:], 16))
    # if the value is an str, convert it
    else:
        return to_type(int(value))