code: def stock2one(stock):
      
      lines = {}
      for line in stock:
          line = line.strip()
          if print_line(line) is True:
              yield line
              continue
          if line.startswith('//'):
              continue
          ID, seq = line.rsplit(' ', 1)
          if ID not in lines:
              lines[ID] = ''
          else:
              # remove preceding white space
              seq = seq.strip()
          lines[ID] += seq
      for ID, line in lines.items():
          yield '\t'.join([ID, line])
      yield '\n//'
docs: convert stockholm to single line format