##### SUMMARY

Implement `find_spec` and `exec_module` in the `RestrictedModuleLoader` for Python 3.10 and later. This depends on updating the collection loader first.

See also: https://github.com/ansible/ansible/issues/72952

Depends on: https://github.com/ansible/ansible/issues/74660

##### ISSUE TYPE

Feature Idea

##### COMPONENT NAME

test/lib/ansible_test/_data/sanity/import/importer.py
"""Monitor sys.modules for unwanted changes, reverting any additions made to our own namespaces."""
        snapshot = sys.modules.copy()
        try:
            yield
        finally:
            check_sys_modules(path, snapshot, messages)
            for key in set(sys.modules.keys()) - set(snapshot.keys()):
                if is_name_in_namepace(key, ('ansible', 'ansible_collections')):
                    del sys.modules[key]  
    @contextlib.contextmanager
    def capture_output(capture):
        """Capture sys.stdout and sys.stderr.
        :type capture: Capture
        """
        old_stdout = sys.stdout
        old_stderr = sys.stderr
        sys.stdout = capture.stdout
        sys.stderr = capture.stderr
        
        for module in sys.modules.values():
            try: