def _getPythonFlags(self, pathName, bootstrapPythonFlags=None):
        if pathName in self.pythonFlagCache:
            return self.pythonFlagCache[pathName]

        if bootstrapPythonFlags:
            self.pythonFlagCache[pathName] = bootstrapPythonFlags
            return self.pythonFlagCache[pathName]

        db = self._getDb()
        foundPath = False

        # FIXME: This should be iterFilesByPath when implemented (CNY-1833)
        # For now, cache all the python deps in all the files in the
        # trove(s) so that we iterate over each trove only once
        containingTroveList = db.iterTrovesByPath(pathName)
        for containerTrove in containingTroveList:
            for pathid, p, fileid, v in containerTrove.iterFileList():
                if pathName == p:
                    foundPath = True
                pythonFlags = set()
                f = files.ThawFile(db.getFileStream(fileid), pathid)
                for dep in f.provides().iterDepsByClass(
                        deps.PythonDependencies):
                    flagNames = [x[0] for x in dep.getFlags()[0]]
                    pythonFlags.update(flagNames)
                self.pythonFlagCache[p] = pythonFlags

        if not foundPath:
            self.pythonFlagCache[pathName] = self._warnPythonPathNotInDB(
                pathName)

        return self.pythonFlagCache[pathName]