def METHOD_NAME(
    self, val: bytes, typ: bytes
) -> Optional[Union[bool, str, int, float, datetime.datetime, list]]:
    if val == self.unset_field:
        return None
    if typ == b"bool":
        return val == b"T"
    container_type = CONTAINER_TYPE.search(typ)
    if container_type is not None:
        if val == self.empty_field:
            return []
        _, elt_type = container_type.groups()
        return [self.METHOD_NAME(x, elt_type) for x in val.split(self.set_sep)]
    if typ in self.int_types:
        return int(val)
    if typ in self.float_types:
        return float(val)
    if typ in self.time_types:
        return datetime.datetime.fromtimestamp(float(val))
    if val == self.empty_field:
        return ""
    return val.decode()