import importlib


def load_from_package(name, attr):
    """Load `attr` from the package `name`."""
    try:
        module = importlib.import_module(name)
        if module is None:
            return None
        return getattr(module, attr, None)
    except ImportError:
        pass
    return None