def get_style(self, attribute):
        '''Get the document's named style at the caret's current position.

        If there is a text selection and the style varies over the selection,
        `pyglet.text.document.STYLE_INDETERMINATE` is returned.

        :Parameters:
            `attribute` : str
                Name of style attribute to retrieve.  See
                `pyglet.text.document` for a list of recognised attribute
                names.

        :rtype: object
        '''
        if self._mark is None or self._mark == self._position:
            try:
                return self._next_attributes[attribute]
            except __HOLE__:
                return self._layout.document.get_style(attribute, 
                                                          self._position)

        start = min(self._position, self._mark)
        end = max(self._position, self._mark)
        return self._layout.document.get_style_range(attribute, start, end)
dataset/ETHPy150Open ardekantur/pyglet/pyglet/text/caret.py/Caret.get_style