def safe_import_module(module_name):
    """
    Like :func:`importlib.import_module`, except it does not raise ``ImportError``
    if the requested ``module_name`` was not found.
    """
    try:
        return import_module(module_name)
    except ImportError as e:
        m = re.match(r"No module named '([\w\.]+)'", str(e))
        if not m or not module_name.startswith(m.group(1)):
            raise e
def safe_import_module ( module_name ) : try : return import_module ( module_name ) except ImportError as e : m = re . match ( r"No module named '([\w\.]+)'" , str ( e ) ) if not m or not module_name . startswith ( m . group ( 1 ) ) : raise e
Like :func:`importlib.import_module`, except it does not raise ``ImportError``
    if the requested ``module_name`` was not found.