code: def __get_favorites(self, favorite_type, start=0, max_items=100):
          
          if favorite_type not in (RADIO_SHOWS, RADIO_STATIONS):
              favorite_type = SONOS_FAVORITES
  
          response = self.contentDirectory.Browse([
              ('ObjectID',
               'FV:2' if favorite_type is SONOS_FAVORITES
               else 'R:0/{0}'.format(favorite_type)),
              ('BrowseFlag', 'BrowseDirectChildren'),
              ('Filter', '*'),
              ('StartingIndex', start),
              ('RequestedCount', max_items),
              ('SortCriteria', '')
          ])
          result = {}
          favorites = []
          results_xml = response['Result']
  
          if results_xml != '':
              # Favorites are returned in DIDL-Lite format
              metadata = XML.fromstring(really_utf8(results_xml))
  
              for item in metadata.findall(
                      '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}container'
                      if favorite_type == RADIO_SHOWS else
                      '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}item'):
                  favorite = {}
                  favorite['title'] = item.findtext(
                      '{http://purl.org/dc/elements/1.1/}title')
                  favorite['uri'] = item.findtext(
                      '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}res')
                  if favorite_type == SONOS_FAVORITES:
                      favorite['meta'] = item.findtext(
                          '{urn:schemas-rinconnetworks-com:metadata-1-0/}resMD')
                  favorites.append(favorite)
  
          result['total'] = response['TotalMatches']
          result['returned'] = len(favorites)
          result['favorites'] = favorites
  
          return result
docs: Helper method for `get_favorite_radio_*` methods.
  
          Args:
              favorite_type (str): Specify either `RADIO_STATIONS` or
                  `RADIO_SHOWS`.
              start (int): Which number to start the retrieval from. Used for
                  paging.
              max_items (int): The total number of results to return.