def rotate(list_, pivot):
    """
    Rotate a list around a pivot.
    """
    try:
        pos = list_.index(pivot)
    except ValueError:
        # pivot not in list
        return list_
    else:
        return list_[pos:] + list_[:pos]