import itertools


def cycle(collection):
    """:yaql:cycle

    Makes an iterator returning elements from the collection as if it cycled.

    :signature: collection.cycle()
    :receiverArg collection: value to be cycled
    :argType collection: iterable
    :returnType: iterator

    .. code::

        yaql> [1, 2].cycle().take(5)
        [1, 2, 1, 2, 1]
    """
    return itertools.cycle(collection)