@classmethod
def decode_conjure_union_type(cls, obj, conjure_type):
    """Decodes json into a conjure union type.

        Args:
            obj: the json object to decode
            conjure_type: a class object which is the union type
                we're decoding into
        Returns:
            An instance of type conjure_type.
        """
    type_of_union = obj['type']
    for attr, conjure_field in conjure_type._options().items():
        if conjure_field.identifier == type_of_union:
            attribute = attr
            conjure_field_definition = conjure_field
            break
    else:
        raise ValueError('unknown union type {0} for {1}'.format(
            type_of_union, conjure_type))
    deserialized = {}
    if type_of_union not in obj or obj[type_of_union] is None:
        cls.check_null_field(obj, deserialized, conjure_field_definition)
    else:
        value = obj[type_of_union]
        field_type = conjure_field_definition.field_type
        deserialized[attribute] = cls.do_decode(value, field_type)
    return conjure_type(**deserialized)
