code: def is_collapsed(block):
          
          if block is None:
              return False
          state = block.userState()
          if state == -1:
              state = 0
          return bool(state & 0x08000000)
docs: Checks if the block is expanded or collased.
  
          :param block: QTextBlock
          :return: False for an open trigger, True for for closed trigger