'take a auto-completed path and return the corresponding module'

def get_module_from_path(self, shell_path):

    tab = shell_path.strip('/').split('/')
    if (len(tab) == 2):
        for mod in self.categories[tab[0]]:
            if (mod.get_name() == tab[1]):
                return mod
    elif (len(tab) == 3):
        for mod in self.categories[tab[1]]:
            if (self.is_os_compatible(mod, tab[0]) and (mod.get_name() == tab[2])):
                return mod
