code: def strip_from_ansi_esc_sequences(text):
      
      # esc[ + values + control character
      # h, l, p commands are complicated, let's ignore them
      seq_regex = r"\x1b\[[0-9;]*[mKJusDCBAfH]"
      regex = re.compile(seq_regex)
      start = 0
      response = ""
      for match in regex.finditer(text):
          end = match.start()
          response += text[start:end]
  
          start = match.end()
      response += text[start:len(text)]
      return response
docs: find ANSI escape sequences in text and remove them
  
      :param text: str
      :return: list, should be passed to ListBox