code: def kelvin2rgb(temperature):
      
      # range check
      if temperature < 1000:
          temperature = 1000
      elif temperature > 40000:
          temperature = 40000
  
      tmp_internal = temperature / 100.0
  
      # red
      if tmp_internal <= 66:
          red = 255
      else:
          tmp_red = 329.698727446 * np.power(tmp_internal - 60, -0.1332047592)
          if tmp_red < 0:
              red = 0
          elif tmp_red > 255:
              red = 255
          else:
              red = tmp_red
  
      # green
      if tmp_internal <= 66:
          tmp_green = 99.4708025861 * np.log(tmp_internal) - 161.1195681661
          if tmp_green < 0:
              green = 0
          elif tmp_green > 255:
              green = 255
          else:
              green = tmp_green
      else:
          tmp_green = 288.1221695283 * np.power(tmp_internal - 60, -0.0755148492)
          if tmp_green < 0:
              green = 0
          elif tmp_green > 255:
              green = 255
          else:
              green = tmp_green
  
      # blue
      if tmp_internal >= 66:
          blue = 255
      elif tmp_internal <= 19:
          blue = 0
      else:
          tmp_blue = 138.5177312231 * np.log(tmp_internal - 10) - 305.0447927307
          if tmp_blue < 0:
              blue = 0
          elif tmp_blue > 255:
              blue = 255
          else:
              blue = tmp_blue
  
      return [red / 255, green / 255, blue / 255]
docs: Converts from Kelvin temperature to an RGB color.
  
      Algorithm credits: |tannerhelland|_