import importlib


def safe_import(module):
    """
    Try to import a module by (dotted) name and return None if
    the import fails by any reason.

    """
    try:
        return importlib.import_module(module)
    except:
        return None