importlib.util.spec_from_loader(name, loader, *, origin=None, is_package=None)
A factory function for creating a ModuleSpec instance based on a loader. The parameters have the same meaning as they do for ModuleSpec. The function uses available loader APIs, such as InspectLoader.is_package(), to fill in any missing information on the spec.
New in version 3.4.