def METHOD_NAME(self, glyph_id):
    if self['ClassFormat'] == 1:
        index = glyph_id - self['StartGlyph']
        if 0 <= index < self['GlyphCount']:
            return self['ClassValueArray'][index]
    else:
        for record in self['ClassRangeRecord']:
            if record['Start'] <= glyph_id <= record['End']:
                return record['Class']
    return 0