def __setitem__(self, key, value):
        # Required by collections.MutableSequence

        if not isinstance(key, (int, slice)):
            raise TypeError(
                'list indices must be int or slice, not %s' %
                key.__class__.__name__)
        if isinstance(key, slice):
            if not isinstance(value, collections.Iterable):
                raise TypeError('can only assign an iterable')
        if isinstance(key, int):
            if not 0 <= key < self.__len__():
                raise IndexError('list index out of range')
            key = slice(key, key + 1)
            value = [value]

        for i, val in enumerate(value, key.start):
            self._playlist.add_tracks(val, index=i)

        key = slice(key.start + len(value), key.stop + len(value), key.step)
        del self[key]
dataset/ETHPy150Open mopidy/pyspotify/spotify/playlist.py/_Tracks.__setitem__/original