<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_sonos_playlist_by_attr(self, attr_name, match):
 """Return the first Sonos Playlist DidlPlaylistContainer that matches the attribute specified. Args: attr_name (str):
 DidlPlaylistContainer attribute to compare. The most useful being: 'title' and 'item_id'. match (str):
 Value to match. Returns: (:class:`~.soco.data_structures.DidlPlaylistContainer`):
 The first matching playlist object. Raises: (AttributeError):
 If indicated attribute name does not exist. (ValueError):
 If a match can not be found. Example:: device.get_sonos_playlist_by_attr('title', 'Foo') device.get_sonos_playlist_by_attr('item_id', 'SQ:3') """

        for sonos_playlist in self.get_sonos_playlists():
            if getattr(sonos_playlist, attr_name) == match:
                return sonos_playlist
        raise ValueError('No match on "{0}" for value "{1}"'.format(attr_name,
                                                                    match))