input: Write a python function to parse the given HTML to extract the course structure as a nested dictionary.
  assert parse_course_structure(html_string) == {
      "Programming": {
          "Python": ["Basics", "Data Structures", "Advanced Topics"],
          "Javascript": ["Basics", "Object Oriented Programming"]
      },
      "Design": {
          "UI/UX Design": ["Wireframing", "Prototyping", "Visual Design"],
          "Graphic Design": ["Logo Design", "Illustration"]
      }
  }
  assert parse_course_structure("<html><body><ul><li>Test<ul><li>Example</li></ul></li></ul></body></html>") == {"Test": ["Example"]}
output: def parse_course_structure(html_string):
      from bs4 import BeautifulSoup
  
      def parse_list(ul_tag):
          result = {}
          for li in ul_tag.find_all('li', recursive=False):
              if li.ul:
                  result[li.contents[0].strip()] = parse_list(li.ul)
              else:
                  if isinstance(result, dict):
                      result = []
                  result.append(li.get_text(strip=True))
          return result
  
      soup = BeautifulSoup(html_string, 'html.parser')
      main_ul = soup.find('ul')
      return parse_list(main_ul)