code: def _join_lines(txt):
      
      txt = txt or ''  # Handle NoneType input values
      val = ''
      lines = txt.split('\n')
      for line in lines:
          stripped = line.strip()
          if len(stripped) == 0:
              continue
          val += stripped + ' '
      return val.strip()
docs: Remove whitespace from XML input