def alternating_values(initial_value=False):
    """
    Provides an infinite source of values alternating between :data:`True` and
    :data:`False`, starting wth *initial_value* (which defaults to
    :data:`False`). For example, to produce a flashing LED::

        from gpiozero import LED
        from gpiozero.tools import alternating_values
        from signal import pause

        red = LED(2)

        red.source_delay = 0.5
        red.source = alternating_values()

        pause()
    """
    value = initial_value
    while True:
        yield value
        value = not value
