def METHOD_NAME(name, typ, value):
    if typ in types:
        if value is None:
            return [
                "bytes32",
                "0x0000000000000000000000000000000000000000000000000000000000000000",
            ]
        else:
            return ["bytes32", fast_keccak(encode_data(typ, value, types))]
    if value is None:
        raise Exception(f"Missing value for field {name} of type {type}")
    # Accept string bytes
    if "bytes" in typ and isinstance(value, str):
        value = HexBytes(value)
    # Accept string uint and int
    if "int" in typ and isinstance(value, str):
        value = int(value)
    if typ == "bytes":
        return ["bytes32", fast_keccak(value)]
    if typ == "string":
        # Convert string to bytes.
        value = value.encode("utf-8")
        return ["bytes32", fast_keccak(value)]
    if typ.endswith("]"):
        # Array type
        if value:
            parsed_type = typ[: typ.rindex("[")]
            type_value_pairs = [METHOD_NAME(name, parsed_type, v) for v in value]
            data_types, data_hashes = zip(*type_value_pairs)
        else:
            # Empty array
            data_types, data_hashes = [], []
        h = fast_keccak(encode_abi(data_types, data_hashes))
        return ["bytes32", h]
    return [typ, value]