'Determine where a given Python module object came from by looking at path
entries.'

def _findEntryPathString(self, modobj):

    topPackageObj = modobj
    while ('.' in topPackageObj.__name__):
        topPackageObj = self.moduleDict['.'.join(topPackageObj.__name__.split('.')[:(-1)])]
    if _isPackagePath(FilePath(topPackageObj.__file__)):
        rval = dirname(dirname(topPackageObj.__file__))
    else:
        rval = dirname(topPackageObj.__file__)
    if (rval not in self.importerCache):
        warnings.warn(('%s    (for    module    %s)    not    in    path    importer    cache    (PEP    302    violation    -    check    your    local    configuration).' % (rval, modobj.__name__)), stacklevel=3)
    return rval
