<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def transform_soups(config, soups, precomputed):
 """Mutate our soups to be better when we write them out later."""

  fixup_internal_links(config, soups)
  ensure_headings_linkable(soups)

  # Do this after ensure_headings_linkable so that there will be links.
  generate_page_tocs(soups, precomputed)
  link_pantsrefs(soups, precomputed)