def to_source_filename(self, filename):
        key = filename
        rv = self.source_filename_cache.get(key)
        if rv is not None:
            return rv
        folder = os.path.abspath(self.env.root_path)
        if isinstance(folder, text_type) and not isinstance(filename, text_type):
            filename = filename.decode(fs_enc)
        filename = os.path.normpath(os.path.join(folder, filename))
        if filename.startswith(folder):
            filename = filename[len(folder):].lstrip(os.path.sep)
            if os.path.altsep:
                filename = filename.lstrip(os.path.altsep)
        else:
            raise ValueError('The given value (%r) is not below the '
                             'source folder (%r)' %
                             (filename, self.env.root_path))
        rv = filename.replace(os.path.sep, '/')
        self.source_filename_cache[key] = rv
        return rv
Make sure NOT doesn't mutate operands.
dataset/ETHPy150Open lektor/lektor/lektor/builder.py/PathCache.to_source_filename--crossover with--dataset/ETHPy150Open mozilla/elasticutils/elasticutils/tests/test_query.py/FilterTest.test_f_mutation_with_not