def import_class(import_str):
 (mod_str, _sep, class_str) = import_str.rpartition('.')
 try:
  __import__(mod_str)
  return getattr(sys.modules[mod_str], class_str)
 except (ValueError, AttributeError):
  raise ImportError(('Class %s cannot be found (%s)' % (class_str, traceback.format_exception(*sys.exc_info()))))

def import_class ( import_str ) : ( mod_str , _sep , class_str ) = import_str . rpartition ( '.' ) try : __import__ ( mod_str ) return getattr ( sys . modules [ mod_str ] , class_str ) except ( ValueError , AttributeError ) : raise ImportError ( ( 'Class %s cannot be found (%s)' % ( class_str , traceback . format_exception ( * sys . exc_info ( ) ) ) ) )
returns a class from a string including module and class .