def _determine_existing_modules(self):
        """
            Find out which of the modules
            from specified path are already
            imported (e.g. present in sys.modules)
            those modules should not be replaced
            by stubs.
        """
        known = 0
        while known < len(self.elements) and '.'.join(self.elements[:known + 1]) in sys.modules:
            known += 1
        self.known_path = '.'.join(self.elements[:known])
        self.elements = self.elements[known:]
dataset/ETHPy150Open menpo/menpo/menpo/testing.py/surrogate._determine_existing_modules/original