def _get_parent_module(module):
    parent = sys.modules
    splt = module.__name__.split('.')
    if len(splt) > 1:
        for module_name in splt[:-1]:
            try:
                parent = getattr(parent, module_name)
            except AttributeError:
                parent = parent[module_name]
    return parent
dataset/ETHPy150Open django-silk/silk/silk/profiling/dynamic.py/_get_parent_module/original