code: def cos_values(period=360):
      
      angles = (2 * pi * i / period for i in range(period))
      for a in cycle(angles):
          yield cos(a)
docs: Provides an infinite source of values representing a cosine wave (from -1
      to +1) which repeats every *period* values. For example, to produce a
      "siren" effect with a couple of LEDs that repeats once a second::
  
          from gpiozero import PWMLED
          from gpiozero.tools import cos_values, scaled, inverted
          from signal import pause
  
          red = PWMLED(2)
          blue = PWMLED(3)
  
          red.source_delay = 0.01
          blue.source_delay = red.source_delay
          red.source = scaled(cos_values(100), 0, 1, -1, 1)
          blue.source = inverted(red)
  
          pause()
  
      If you require a different range than -1 to +1, see :func:`scaled`.