def getXLevelStats(self, sh_order):
        """ Checks and return the stats about the levels for different X-rules in the current span.
            This is used only for Shallow-n Hiero, particularly in X productions.
            Returns a list of boolean flags for each level of X-rules in the current span upto the top_X_level.
            Each flag can be True (if at least one terminal 'X' entry is found) or false (otherwise).
        """

        left_side = "X"
        for key in self.table.iterkeys():
            if key[0] != left_side: continue

            found_levels = 0
            curr_depth = self.top_X_level + 1 if self.top_X_level < sh_order else sh_order
            XLevels = [False for i in xrange(curr_depth)]
            for entry in self.table[key]:
                entry_depth = entry.depth_hier
                if entry_depth < curr_depth:
                    try:
                        if not XLevels[entry_depth]:
                            XLevels[entry_depth] = True
                            found_levels += 1
                    except __HOLE__:
                        sys.stderr.write("ERROR: Index Out of Range error in cell.py : 291\n")
                        sys.stderr.write("       Index %d exceeds the size of array XLevels (%d). Exiting!!\n" % (entry_depth, curr_depth))
                        sys.exit(1)
                if (found_levels == curr_depth): break

            return XLevels
dataset/ETHPy150Open sfu-natlang/Kriya/src/Kriya-Decoder/cell.py/Cell.getXLevelStats