def module_sys_modules_key(key):
    """
    Check if a module is in the sys.modules dictionary in some manner.  If so,
    return the key used in that dictionary.

    :param key: our key to the module.
    :returns: the key in sys.modules or None.
    """
    moduleparts = key.split(".")
    for partnum, part in enumerate(moduleparts):
        modkey = ".".join(moduleparts[partnum:])
        if modkey in sys.modules:
            return modkey
    return None