Parses the DOM and returns character attributes in the sidebar.

    :type character_page: :class:`bs4.BeautifulSoup`
    :param character_page: MAL character page's DOM

    :rtype: dict
    :return: Character attributes

    :raises: :class:`.InvalidCharacterError`, :class:`.MalformedCharacterPageError`

def parse_sidebar(self, character_page):
    """Parses the DOM and returns character attributes in the sidebar.

    :type character_page: :class:`bs4.BeautifulSoup`
    :param character_page: MAL character page's DOM

    :rtype: dict
    :return: Character attributes

    :raises: :class:`.InvalidCharacterError`, :class:`.MalformedCharacterPageError`
    """
    character_info = {}

    error_tag = character_page.find(u'div', {'class': 'badresult'})
    if error_tag:
      # MAL says the character does not exist.
      raise InvalidCharacterError(self.id)

    try:
      full_name_tag = character_page.find(u'div', {'id': 'contentWrapper'}).find(u'h1')
      if not full_name_tag:
        # Page is malformed.
        raise MalformedCharacterPageError(self.id, html, message="Could not find title div")
      character_info[u'full_name'] = full_name_tag.text.strip()
    except:
      if not self.session.suppress_parse_exceptions:
        raise

    info_panel_first = character_page.find(u'div', {'id': 'content'}).find(u'table').find(u'td')

    try:
      picture_tag = info_panel_first.find(u'img')
      character_info[u'picture'] = picture_tag.get(u'src').decode('utf-8')
    except:
      if not self.session.suppress_parse_exceptions:
        raise

    try:
      # assemble animeography for this character.
      character_info[u'animeography'] = {}
      animeography_header = info_panel_first.find(u'div', text=u'Animeography')
      if animeography_header:
        animeography_table = animeography_header.find_next_sibling(u'table')
        for row in animeography_table.find_all(u'tr'):
          # second column has anime info.
          info_col = row.find_all(u'td')[1]
          anime_link = info_col.find(u'a')
          link_parts = anime_link.get(u'href').split(u'/')
          # of the form: /anime/1/Cowboy_Bebop
          anime = self.session.anime(int(link_parts[2])).set({'title': anime_link.text})
          role = info_col.find(u'small').text
          character_info[u'animeography'][anime] = role
    except:
      if not self.session.suppress_parse_exceptions:
        raise

    try:
      # assemble mangaography for this character.
      character_info[u'mangaography'] = {}
      mangaography_header = info_panel_first.find(u'div', text=u'Mangaography')
      if mangaography_header:
        mangaography_table = mangaography_header.find_next_sibling(u'table')
        for row in mangaography_table.find_all(u'tr'):
          # second column has manga info.
          info_col = row.find_all(u'td')[1]
          manga_link = info_col.find(u'a')
          link_parts = manga_link.get(u'href').split(u'/')
          # of the form: /manga/1/Cowboy_Bebop
          manga = self.session.manga(int(link_parts[2])).set({'title': manga_link.text})
          role = info_col.find(u'small').text
          character_info[u'mangaography'][manga] = role
    except:
      if not self.session.suppress_parse_exceptions:
        raise

    try:
      num_favorites_node = info_panel_first.find(text=re.compile(u'Member Favorites: '))
      character_info[u'num_favorites'] = int(num_favorites_node.strip().split(u': ')[1])
    except:
      if not self.session.suppress_parse_exceptions:
        raise

    return character_info