def alternator(iterable, frontFirst=True):
    """
    Alternates an iterable from front to back and returns the alternation as a list.
    Example:
    [0, 1, 2, 3, 4, 5]
    turns into
    [0, 5, 1, 4, 2, 3] if frontFirst is True and
    [5, 0, 4, 1, 3, 2] if frontFirst is False.

    Args:
        iterable (iterable): some iterable to alternate.
        frontFirst (bool, optional): whether to use the front element first or the
            back element first. Defaults to True, so front element first.

    Returns:
        list: the alternated iterable.
    """
    res = iterable.copy()
    idx = 0
    flipper = frontFirst
    while len(iterable) > 0:
        if flipper:
            res[idx] = iterable.pop(0)
        else:
            res[idx] = iterable.pop(-1)
        flipper = not flipper
        idx += 1
    return res