def resolve_dotted(name):
 names = name.split('.')
 path = names.pop(0)
 target = __import__(path)
 while names:
  segment = names.pop(0)
  path += ('.' + segment)
  try:
   target = getattr(target, segment)
  except AttributeError:
   __import__(path)
   target = getattr(target, segment)
 return target

def resolve_dotted ( name ) : names = name . split ( '.' ) path = names . pop ( 0 ) target = __import__ ( path ) while names : segment = names . pop ( 0 ) path += ( '.' + segment ) try : target = getattr ( target , segment ) except AttributeError : __import__ ( path ) target = getattr ( target , segment ) return target
given the dotted name for a python object .