code: def sort(lines):
      lines = list(lines)
      new_lines = parse_block(lines, header=True)
      for block in sorted(parse_blocks(lines), key=first_key):
          if new_lines:
              new_lines.append('')
          new_lines.extend(block)
      return new_lines