<s> import sys <EOL> import inspect <EOL> class BackendPluginFactory ( object ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def create ( cls , plugin_name = "<STR_LIT>" , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> backendplugin = None <EOL> plugin_path = "<STR_LIT>" . format ( plugin_name ) <EOL> __import__ ( plugin_path ) <EOL> pluginobj = sys . modules [ plugin_path ] <EOL> pluginclasses = inspect . getmembers ( pluginobj , inspect . isclass ) <EOL> for classname , classobj in pluginclasses : <EOL> if inspect . getmodule ( classobj ) . __name__ . find ( plugin_path ) == <NUM_LIT:0> : <EOL> try : <EOL> backendplugin = classobj ( ** kwargs ) <EOL> except Exception as error : <EOL> raise Exception ( "<STR_LIT>" . format ( error ) ) <EOL> return backendplugin </s>
