<s> from django . core . exceptions import ImproperlyConfigured <EOL> from django . utils . importlib import import_module <EOL> def load_widget ( path ) : <EOL> """<STR_LIT>""" <EOL> if not path : <EOL> return <EOL> index = path . rfind ( '<STR_LIT:.>' ) <EOL> module , attr = path [ : index ] , path [ index + <NUM_LIT:1> : ] <EOL> try : <EOL> mod = import_module ( module ) <EOL> return getattr ( mod , attr ) <EOL> except ( ImportError , ValueError , AttributeError ) , e : <EOL> raise ImproperlyConfigured ( <EOL> '<STR_LIT>' . format ( path , e ) ) </s>
