def animate_flash(self, color, groups=('LEFT', 'RIGHT'), sleeptime=0.5, duration=5, block=True):
        """
        Turn all LEDs in ``groups`` off/on to ``color`` every ``sleeptime`` seconds

        Animate for ``duration`` seconds.  If ``duration`` is None animate for forever.

        Example:

        .. code-block:: python

            from ev3dev2.led import Leds
            leds = Leds()
            leds.animate_flash('AMBER', sleeptime=0.75, duration=10)
        """

        def _animate_flash():
            even = True
            start_time = dt.datetime.now()

            while True:
                if even:
                    for group in groups:
                        self.set_color(group, color)
                else:
                    self.all_off()

                if self.animate_thread_stop or duration_expired(start_time, duration):
                    break

                even = not even
                sleep(sleeptime)

            self.animate_thread_stop = False
            self.animate_thread_id = None

        self.animate_stop()

        if block:
            _animate_flash()
        else:
            self.animate_thread_id = _thread.start_new_thread(_animate_flash, ())
Turn all LEDs in ``groups`` off/on to ``color`` every ``sleeptime`` seconds

        Animate for ``duration`` seconds.  If ``duration`` is None animate for forever.

        Example:

        .. code-block:: python

            from ev3dev2.led import Leds
            leds = Leds()
            leds.animate_flash('AMBER', sleeptime=0.75, duration=10)