code: def find_existing_anchors(soup):
    
    existing_anchors = set()
    for tag in soup.find_all(True):
      for attr in ['id', 'name']:
        if tag.has_attr(attr):
          existing_anchors.add(tag.get(attr))
    return existing_anchors
docs: Return existing ids (and names) from a soup.