def link_pantsrefs(soups, precomputed):
  """Transorm soups: <a pantsref="foo"> becomes <a href="../foo_page.html#foo">"""
  for (page, soup) in soups.items():
    for a in soup.find_all('a'):
      if not a.has_attr('pantsref'):
        continue
      pantsref = a['pantsref']
      if not pantsref in precomputed.pantsref:
        raise TaskError('Page {} has pantsref "{}" and I cannot find pantsmark for'
                        ' it'.format(page, pantsref))
      a['href'] = rel_href(page, precomputed.pantsref[pantsref])
Transorm soups: <a pantsref="foo"> becomes <a href="../foo_page.html#foo">