code: def maxCtxContextualRule(maxCtx, st, chain):
      
  
      if not chain:
          return max(maxCtx, st.GlyphCount)
      elif chain == 'Reverse':
          return max(maxCtx, st.GlyphCount + st.LookAheadGlyphCount)
      return max(maxCtx, st.InputGlyphCount + st.LookAheadGlyphCount)
docs: Calculate usMaxContext based on a contextual feature rule.