def module_parent_packages(full_modname):
 prefix = ''
 parents = []
 for pkg in full_modname.split('.')[0:(-1)]:
  prefix += (('.' + pkg) if prefix else pkg)
  parents.append(prefix)
 return parents

def module_parent_packages ( full_modname ) : prefix = '' parents = [ ] for pkg in full_modname . split ( '.' ) [ 0 : ( - 1 ) ] : prefix += ( ( '.' + pkg ) if prefix else pkg ) parents . append ( prefix ) return parents
return list of parent package names .