##### 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
ANSIBLE_TEST_CONTROLLER_ROOT,
    ApplicationError,
    is_subdir,
)
from ...util_common import (
    intercept_python,
)
from ...ansible_util import (
    ansible_environment,
)
from ...config import (
    SanityConfig,
)
from ...host_configs import (
    PythonConfig,
    VirtualPythonConfig,
)
class MypyTest(SanityMultipleVersion):
    """Sanity test which executes mypy."""
    ansible_only = True
    def filter_targets(self, targets):  
        """Return the given list of test targets, filtered to include only those relevant for the test."""
        return [target for target in targets if os.path.splitext(target.path)[1] == '.py' and (
                target.path.startswith('lib/ansible/') or target.path.startswith('test/lib/ansible_test/_internal/'))]
    @property
    def error_code(self):  
        """Error code for ansible-test matching the format used by the underlying test program, or None if the program does not use error codes."""
        return 'ansible-test'
    @property
    def needs_pypi(self):