code: def clean_line_profile_text(text):
      profile_block_list = parse_rawprofile_blocks(text)
      prefix_list, timemap = parse_timemap_from_blocks(profile_block_list)
      sorted_lists = sorted(six.iteritems(timemap), key=operator.itemgetter(0))
      newlist = prefix_list[:]
      for key, val in sorted_lists:
          newlist.extend(val)
      output_text = '\n'.join(newlist)
      summary_text = get_summary(profile_block_list)
      output_text = output_text
      return output_text, summary_text