'Save the playlist.
For a playlist to be saveable, it must have the ``uri`` attribute set.
You must not set the ``uri`` atribute yourself, but use playlist
objects returned by :meth:`create` or retrieved from :attr:`playlists`,
which will always give you saveable playlists.
The method returns the saved playlist. The return playlist may differ
from the saved playlist. E.g. if the playlist name was changed, the
returned playlist may have a different URI. The caller of this method
must throw away the playlist sent to this method, and use the
returned playlist instead.
If the playlist\'s URI isn\'t set or doesn\'t match the URI scheme of a
current backend, nothing is done and :class:`None` is returned.
:param playlist: the playlist
:type playlist: :class:`mopidy.models.Playlist`
:rtype: :class:`mopidy.models.Playlist` or :class:`None`'

def save(self, playlist):

    validation.check_instance(playlist, Playlist)
    if (playlist.uri is None):
        return
    uri_scheme = urllib.parse.urlparse(playlist.uri).scheme
    backend = self.backends.with_playlists.get(uri_scheme, None)
    if (not backend):
        return None
    with _backend_error_handling(backend, reraise=AssertionError):
        playlist = backend.playlists.save(playlist).get()
        ((playlist is None) or validation.check_instance(playlist, Playlist))
        if playlist:
            listener.CoreListener.send(u'playlist_changed', playlist=playlist)
        return playlist
    return None
