def reverse(src, start, length):
    """Reverse a sublist, wrapping around.

    :src: source list
    :start: start of the sublist
    :length: length of the sublist
    :returns: new list with the elements from start till
              (start+length) % len(src) reversed

    >>> x = [1, 2, 3, 4, 5]
    >>> reverse(x, 2, 4)
    [3, 2, 1, 5, 4]
    >>> reverse(x, 0, 2)
    [2, 1, 3, 4, 5]
    >>> reverse(x, 4, 2)
    [5, 2, 3, 4, 1]
    """
    size = len(src)
    dst = src[:]

    for i in range(length // 2):
        a = (i + start) % size
        b = ((start + length) - i - 1) % size
        dst[a], dst[b] = src[b], src[a]

    return dst