##### 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
"""Exception thrown during initialization of ImporterAnsibleModule."""
    class ImporterAnsibleModule:
        """Replacement for AnsibleModule to support import testing."""
        def __init__(self, *args, **kwargs):
            raise ImporterAnsibleModuleException()
    class RestrictedModuleLoader:
        """Python module loader that restricts inappropriate imports."""
        def __init__(self, path, name, restrict_to_module_paths):
            self.path = path
            self.name = name
            self.loaded_modules = set()
            self.restrict_to_module_paths = restrict_to_module_paths
        def find_module(self, fullname, path=None):
            """Return self if the given fullname is restricted, otherwise return None.
            :param fullname: str
            :param path: str
            :return: RestrictedModuleLoader | None
            """
            if fullname in self.loaded_modules:
                return None  
            if is_name_in_namepace(fullname, ['ansible']):
                if not self.restrict_to_module_paths:
                    return None  
                if fullname in ('ansible.module_utils.basic',):
                    return self