code: def strip_brackets(text, brackets=None):
      
      res = []
      for c, type_ in _tokens(text, brackets=brackets):
          if type_ == TextType.text:
              res.append(c)
      return ''.join(res).strip()
docs: Strip brackets and what is inside brackets from text.
  
      .. note::
          If the text contains only one opening bracket, the rest of the text
          will be ignored. This is a feature, not a bug, as we want to avoid that
          this function raises errors too easily.