code: def clean_text(self, text, preserve_space):
          
          if text is None:
              return
          if preserve_space:
              text = text.replace('\r\n', ' ').replace('\n', ' ').replace('\t', ' ')
          else:
              text = text.replace('\r\n', '').replace('\n', '').replace('\t', ' ')
              text = text.strip()
              while ('  ' in text):
                  text = text.replace('  ', ' ')
          return text
docs: Text cleaning as per https://www.w3.org/TR/SVG/text.html#WhiteSpace