<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def lazy_import(module_name, to_import):
 """Return the importing module and a callable for lazy importing. The module named by module_name represents the module performing the import to help facilitate resolving relative imports. to_import is an iterable of the modules to be potentially imported (absolute or relative). The `as` form of importing is also supported, e.g. `pkg.mod as spam`. This function returns a tuple of two items. The first is the importer module for easy reference within itself. The second item is a callable to be set to `__getattr__`. """

    module = importlib.import_module(module_name)
    import_mapping = {}
    for name in to_import:
        importing, _, binding = name.partition(' as ')
        if not binding:
            _, _, binding = importing.rpartition('.')
        import_mapping[binding] = importing

    def __getattr__(name):
        if name not in import_mapping:
            raise ModuleAttributeError(module_name, name)
        importing = import_mapping[name]
        # imortlib.import_module() implicitly sets submodules on this module as
        # appropriate for direct imports.
        imported = importlib.import_module(importing,
                                           module.__spec__.parent)
        setattr(module, name, imported)
        return imported

    return module, __getattr__