code: def importobj(modpath, attrname):
      
      module = __import__(modpath, None, None, ['__doc__'])
      if not attrname:
          return module
  
      retval = module
      names = attrname.split(".")
      for x in names:
          retval = getattr(retval, x)
      return retval
docs: imports a module, then resolves the attrname on it