def is_proper_module(obj):
    """
    Returns ``True`` if ``obj`` can be treated like a garbage collector root.

    That is, if ``obj`` is a module that is in ``sys.modules``.

    >>> import types
    >>> is_proper_module([])
    False
    >>> is_proper_module(types)
    True
    >>> is_proper_module(types.ModuleType('foo'))
    False

    .. versionadded:: 1.8
    """
    return (inspect.ismodule(obj) and
            obj != sys.modules.get(getattr(obj, '__name__', None)))


#
# Internal helpers
#
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/dep/objgraph.py/is_proper_module/operator `is` -> `!=`