def relocate_h2id(soup):
  """Moves the anchor ID to the H2 tag, from the wrapper DIV."""
  for h2 in soup.find_all('h2'):
    div = h2.find_parent('div')
    if div.has_attr('id') and not h2.has_attr('id'):
      # print('Move ID: ' + div['id'])
      h2['id'] = div['id']
      del div['id']
    # Also delete embedded <a> tag
    if h2.find('a'):
      h2.find('a').extract()
  return soup