def _input_with_context(self, gsub, glyph, lookup_index, features):
        """Given GSUB, input glyph, and lookup index, return input to harfbuzz
        to render the input glyph with the referred-to lookup activated.
        """

        # try to get a feature tag to activate this lookup
        for feature in gsub.FeatureList.FeatureRecord:
            if lookup_index in feature.Feature.LookupListIndex:
                features.append(feature.FeatureTag)
                return self.input_from_name(glyph, features)

        # try for a chaining substitution
        for lookup in gsub.LookupList.Lookup:
            for st in lookup.SubTable:
                if lookup.LookupType != 6:
                    continue
                for sub_lookup in st.SubstLookupRecord:
                    if sub_lookup.LookupListIndex != lookup_index:
                        continue
                    if st.LookAheadCoverage:
                        glyphs = [glyph, st.LookAheadCoverage[0].glyphs[0]]
                    elif st.BacktrackCoverage:
                        glyphs = [st.BacktrackCoverage[0].glyphs[0], glyph]
                    else:
                        continue
                    return self._sequence_from_glyph_names(glyphs, features)

        raise ValueError(lookup_index % 'Lookup list index %d not found.')
dataset/ETHPy150Open googlei18n/nototools/nototools/hb_input.py/HbInputGenerator._input_with_context/swapped operands of `%`