'Shuffles the entire tracklist. If ``start`` and ``end`` is given only
shuffles the slice ``[start:end]``.
Triggers the :meth:`mopidy.core.CoreListener.tracklist_changed` event.
:param start: position of first track to shuffle
:type start: int or :class:`None`
:param end: position after last track to shuffle
:type end: int or :class:`None`'

def shuffle(self, start=None, end=None):

    tl_tracks = self._tl_tracks
    if ((start is not None) and (end is not None)):
        assert (start < end), u'start    must    be    smaller    than    end'
    if (start is not None):
        assert (start >= 0), u'start    must    be    at    least    zero'
    if (end is not None):
        assert (end <= len(tl_tracks)), (u'end    can    not    be    larger    than    ' + u'tracklist    length')
    before = tl_tracks[:(start or 0)]
    shuffled = tl_tracks[start:end]
    after = tl_tracks[(end or len(tl_tracks)):]
    random.shuffle(shuffled)
    self._tl_tracks = ((before + shuffled) + after)
    self._increase_version()
