<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __watch_file_system(self):
 """ Watches the file system for paths that have been changed or invalidated on disk. """


        for path, data in self.__paths.items():
            stored_modified_time, is_file = data
            try:
                if not foundations.common.path_exists(path):
                    LOGGER.warning(
                        "!> {0} | '{1}' path has been invalidated and will be unregistered!".format(
                            self.__class__.__name__, path))
                    del (self.__paths[path])
                    if is_file:
                        self.file_invalidated.emit(path)
                    else:
                        self.directory_invalidated.emit(path)
                    continue
            except KeyError:
                LOGGER.debug("> {0} | '{1}' path has been unregistered while iterating!".format(
                    self.__class__.__name__, path))
                continue

            try:
                modified_time = self.get_path_modified_time(path)
            except OSError:
                LOGGER.debug("> {0} | '{1}' path has been invalidated while iterating!".format(
                    self.__class__.__name__, path))
                continue

            if stored_modified_time != modified_time:
                self.__paths[path] = (modified_time, os.path.isfile(path))
                LOGGER.debug("> {0} | '{1}' path has been changed!".format(self.__class__.__name__, path))
                if is_file:
                    self.file_changed.emit(path)
                else:
                    self.directory_changed.emit(path)