def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
<EOL>with _ignore_deprecated_imports(deprecated):<EOL><INDENT>orig_modules = {}<EOL>names_to_remove = []<EOL>_save_and_remove_module(name, orig_modules)<EOL>try:<EOL><INDENT>for fresh_name in fresh:<EOL><INDENT>_save_and_remove_module(fresh_name, orig_modules)<EOL><DEDENT>for blocked_name in blocked:<EOL><INDENT>if not _save_and_block_module(blocked_name, orig_modules):<EOL><INDENT>names_to_remove.append(blocked_name)<EOL><DEDENT><DEDENT>fresh_module = importlib.import_module(name)<EOL><DEDENT>except ImportError:<EOL><INDENT>fresh_module = None<EOL><DEDENT>finally:<EOL><INDENT>for orig_name, module in orig_modules.items():<EOL><INDENT>sys.modules[orig_name] = module<EOL><DEDENT>for name_to_remove in names_to_remove:<EOL><INDENT>del sys.modules[name_to_remove]<EOL><DEDENT><DEDENT>return fresh_module<EOL><DEDENT>
Imports and returns a module, deliberately bypassing the sys.modules cache
    and importing a fresh copy of the module. Once the import is complete,
    the sys.modules cache is restored to its original state.

    Modules named in fresh are also imported anew if needed by the import.
    If one of these modules can't be imported, None is returned.

    Importing of modules named in blocked is prevented while the fresh import
    takes place.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.