code: def clear_sonos_playlist(self, sonos_playlist, update_id=0):
          
          if not isinstance(sonos_playlist, DidlPlaylistContainer):
              sonos_playlist = self.get_sonos_playlist_by_attr('item_id',
                                                               sonos_playlist)
          count = self.music_library.browse(ml_item=sonos_playlist).total_matches
          tracks = ','.join([str(x) for x in range(count)])
          if tracks:
              return self.reorder_sonos_playlist(sonos_playlist, tracks=tracks,
                                                 new_pos='', update_id=update_id)
          else:
              return {'change': 0, 'update_id': update_id, 'length': count}
docs: Clear all tracks from a Sonos playlist.
          This is a convenience method for :py:meth:`reorder_sonos_playlist`.
  
          Example::
  
              device.clear_sonos_playlist(sonos_playlist)
  
          Args:
              sonos_playlist
                  (:py:class:`~.soco.data_structures.DidlPlaylistContainer`):
                  Sonos playlist object or the item_id (str) of the Sonos
                  playlist.
              update_id (int): Optional update counter for the object. If left
                  at the default of 0, it will be looked up.
  
          Returns:
              dict: See :py:meth:`reorder_sonos_playlist`
  
          Raises:
              ValueError: If sonos_playlist specified by string and is not found.
              SoCoUPnPException: See :py:meth:`reorder_sonos_playlist`