<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse(self, media_page):
 """Parses the DOM and returns media attributes in the main-content area. :type media_page: :class:`bs4.BeautifulSoup` :param media_page: MAL media page's DOM :rtype: dict :return: media attributes. """

    media_info = self.parse_sidebar(media_page)

    try:
      synopsis_elt = media_page.find(u'h2', text=u'Synopsis').parent
      utilities.extract_tags(synopsis_elt.find_all(u'h2'))
      media_info[u'synopsis'] = synopsis_elt.text.strip()
    except:
      if not self.session.suppress_parse_exceptions:
        raise

    try:
      related_title = media_page.find(u'h2', text=u'Related ' + self.__class__.__name__)
      if related_title:
        related_elt = related_title.parent
        utilities.extract_tags(related_elt.find_all(u'h2'))
        related = {}
        for link in related_elt.find_all(u'a'):
          href = link.get(u'href').replace(u'http://myanimelist.net', '')
          if not re.match(r'/(anime|manga)', href):
            break
          curr_elt = link.previous_sibling
          if curr_elt is None:
            # we've reached the end of the list.
            break
          related_type = None
          while True:
            if not curr_elt:
              raise MalformedAnimePageError(self.id, related_elt, message="Prematurely reached end of related anime listing")
            if isinstance(curr_elt, bs4.NavigableString):
              type_match = re.match(u'(?P<type>[a-zA-Z\ \-]+):', curr_elt)
              if type_match:
                related_type = type_match.group(u'type')
                break
            curr_elt = curr_elt.previous_sibling
          title = link.text
          # parse link: may be manga or anime.
          href_parts = href.split(u'/')
          # sometimes links on MAL are broken, of the form /anime//
          if href_parts[2] == '':
            continue
          # of the form: /(anime|manga)/1/Cowboy_Bebop
          obj_id = int(href_parts[2])
          new_obj = getattr(self.session, href_parts[1])(obj_id).set({'title': title})
          if related_type not in related:
            related[related_type] = [new_obj]
          else:
            related[related_type].append(new_obj)
        media_info[u'related'] = related
      else:
        media_info[u'related'] = None
    except:
      if not self.session.suppress_parse_exceptions:
        raise

    return media_info