from typing import List


def rotate(rlist: List[int], rn: int = 1, left_rotate: bool = True) -> List[int]:
    """Rotate a list (rlist) by rn indices to the left or right

    :param rlist: list/toople or slicable to be rotated
    :type rlist: list or tuple
    :param rn: steps bywhich to rotate (Default value = 1)
    :type rn: int
    :param left_rotate: True (default) left rotates; False right rotates.
    :type left_rotate: bool
    :returns: rotated list
    :rtype: list

    .. doctest:: python

        >>> rotate([1, 2, 3, 4], left_rotate=True)
        [2, 3, 4, 1]
        >>> rotate([1, 2, 3, 4], left_rotate=False)
        [4, 1, 2, 3]
        >>> rotate([1, 2, 3, 4], rn=4, left_rotate=False)
        [1, 2, 3, 4]

    """

    def _left_rotate(l, n=1):
        """

        :param l:
        :param n:  (Default value = 1)

        """
        return l[n:] + l[:n]

    def _right_rotate(l, n=1):
        """

        :param l:
        :param n:  (Default value = 1)

        """
        return l[-n:] + l[:-n]

    return _left_rotate(rlist, rn) if left_rotate else _right_rotate(rlist, rn)