def make_setting_from_factory(data, factory):
    """ Constructs a new setting from a given dataset, alongst with a factory
    to resolve the setting type to """
    if data["type"] not in factory:
        raise Exception("Unkown setting type: {}".format(data["type"]))
    try:
        instance = factory[data["type"]](data)
    except Exception:
        print("Exception occured while parsing", data)
        raise
    if data:
        raise Exception("Unparsed data left in plugin setting: {}".format(data))
    return instance
 Constructs a new setting from a given dataset, alongst with a factory
    to resolve the setting type to 
metadrive/render_pipeline/rpcore/pluginbase/setting_types.py