def instantiate_from_data(self, object_data):
if isinstance(object_data, dict) and '<STR_LIT:name>' in object_data:<EOL><INDENT>name = object_data['<STR_LIT:name>']<EOL>module = importlib.import_module(name)<EOL>return self.resolve_and_call(module.create, extra_env=object_data)<EOL><DEDENT>if isinstance(object_data, dict) and '<STR_LIT>' in object_data:<EOL><INDENT>factory = object_data['<STR_LIT>']<EOL>module = importlib.import_module(factory)<EOL>params = self.resolve_parameters(module.create, extra_env=object_data)<EOL>return GenericFactory(module.create, params)<EOL><DEDENT>elif isinstance(object_data, dict):<EOL><INDENT>return {k: self.instantiate_from_data(v) for k, v in object_data.items()}<EOL><DEDENT>elif isinstance(object_data, list):<EOL><INDENT>return [self.instantiate_from_data(x) for x in object_data]<EOL><DEDENT>elif isinstance(object_data, Variable):<EOL><INDENT>return object_data.resolve(self.parameters)<EOL><DEDENT>else:<EOL><INDENT>return object_data<EOL><DEDENT>
Instantiate object from the supplied data, additional args may come from the environment