Published: 04 August 2020, 18:00
The colorsys module converts colors between different representations: RGB, YIQ, HLS, and HSV. Yes, it is in the stdlib!
import colorsys colorsys.rgb_to_hsv(0.2, 0.4, 0.4) # (0.5, 0.5, 0.4)