<s> """<STR_LIT>""" <EOL> import sys <EOL> import django <EOL> if django . VERSION [ : <NUM_LIT:2> ] < ( <NUM_LIT:1> , <NUM_LIT:5> ) : <EOL> from django . templatetags . future import url <EOL> else : <EOL> from django . template . defaulttags import url <EOL> if django . VERSION [ : <NUM_LIT:2> ] < ( <NUM_LIT:1> , <NUM_LIT:6> ) : <EOL> from django . utils import six <EOL> from django . utils . importlib import import_module <EOL> from django . core . exceptions import ImproperlyConfigured <EOL> def import_by_path ( dotted_path , error_prefix = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> module_path , class_name = dotted_path . rsplit ( '<STR_LIT:.>' , <NUM_LIT:1> ) <EOL> except ValueError : <EOL> raise ImproperlyConfigured ( "<STR_LIT>" % ( <EOL> error_prefix , dotted_path ) ) <EOL> try : <EOL> module = import_module ( module_path ) <EOL> except ImportError as e : <EOL> msg = '<STR_LIT>' % ( <EOL> error_prefix , module_path , e ) <EOL> six . reraise ( ImproperlyConfigured , ImproperlyConfigured ( msg ) , <EOL> sys . exc_info ( ) [ <NUM_LIT:2> ] ) <EOL> try : <EOL> attr = getattr ( module , class_name ) <EOL> except AttributeError : <EOL> raise ImproperlyConfigured ( '<STR_LIT>' % ( <EOL> error_prefix , module_path , class_name ) ) <EOL> return attr <EOL> elif django . VERSION [ : <NUM_LIT:2> ] < ( <NUM_LIT:1> , <NUM_LIT:8> ) : <EOL> from django . utils . module_loading import import_by_path <EOL> else : <EOL> from django . utils . module_loading import import_string as import_by_path </s>
