def fake_module(new_module):
    """
    Created dummy empty modules
    :param new_module: The name of a module to be faked
    """
    module_names = []
    for name in new_module.split('.'):
        parent_name = '.'.join(module_names)
        module_names.append(name)
        full_name = '.'.join(module_names)

        m = SetuptoolsStub(full_name, '')

        if parent_name != '':
            parent_module = sys.modules[parent_name]
            if name not in parent_module.__dict__:  # cannot use getattr
                # print('setting {}'.format(name))
                setattr(sys.modules[parent_name], name, m)

        if full_name not in list(sys.modules.keys()):
            sys.modules[full_name] = m

    Created dummy empty modules
    :param new_module: The name of a module to be faked
    
bin/pip.py