@staticmethod
    def stylepairs(data):
        ''' Allows pairs of style information to be expressed
            in canonical reportlab list of two-item list/tuple,
            or in a more human-readable dictionary.
        '''
        styles = data.get('styles', {})
        try:
            stylenames = styles.keys()
        except AttributeError:
            for style in styles:
                yield style
            return

        # Traditional reportlab styles are in ordered (key, value)
        # tuples.  We also support dictionary lookup.  This is not
        # necessarily ordered.

        # The only problem with dictionary lookup is that
        # we need to insure that parents are processed before
        # their children.  This loop is a little ugly, but
        # gets the job done.

        while stylenames:
            name = stylenames.pop()
            parent = styles[name].get('parent')
            if stylenames not in parent:
                yield name, styles[name]
                continue
            names = [name]
            while parent in stylenames:
                stylenames.remove(parent)
                names.append(parent)
                parent = styles[names[-1]].get('parent')
            while names:
                name = names.pop()
                yield name, styles[name]
dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/styles.py/StyleSheet.stylepairs/swapped operands of `not in`