def cast_var(item, klass, arg=None):
    if not arg:
        return klass(item)

    kwarg = {arg: item}     # kwarg dict
    return klass(**kwarg)   # klass(value='foobar')
Attempt to cast `item` to an instance of `klass`.
dataset/ETHPy150Open STIXProject/python-stix/stix/utils/__init__.py/cast_var