up = BeautifulSoup(html_doc, 'html.parser')

<span class="code-comment"># Navigating down the tree</span>
content_div = soup.find(id="content")
sections = content_div.find_all("div", class_="section")
print(f"Found {len(sections)} sections")

<span class="code-comment"># Navigating up the tree</span>
first_link = soup.find('a')
parent_li = first_link.parent
parent_ul = parent_li.parent
print(f"Parent of link: {parent_li.name}")
print(f"Parent of list item: {parent_ul.name}")

<span class="code-comment"># Na