def METHOD_NAME(self, playlist):
    if not self._allow_save:
        return None
    old_playlist = self.lookup(playlist.uri)
    if old_playlist is not None:
        index = self._playlists.index(old_playlist)
        self._playlists[index] = playlist
    else:
        self._playlists.append(playlist)
    return playlist