If you like performance, it's best to avoid imports and use your own optimized code
Here's GIMP's code ported to python, tested at 99% acuracy, and improved for performance:
(this code happens to match colorsys almost exactly)
scalar = float # a scale value (0.0 to 1.0)
def hsv_to_rgb( h:scalar, s:scalar, v:scalar, a:scalar ) -> tuple:
if s:
if h == 1.0: h = 0.0
i = int(h*6.0); f = h*6.0 - i
w = v * (1.0 - s)
q = v * (1.0 - s * f)
t = v * (1.0 - s * (1.0 - f))
if i==0: return (v, t, w, a)
if i==1: return (q, v, w, a)
if i==2: return (w, v, t, a)
if i==3: return (w, q, v, a)
if i==4: return (t, w, v, a)
if i==5: return (v, w, q, a)
else: return (v, v, v, a)
output:
>>> hsv_to_rgb( 359/360.0, 1.0, 1.0, 1.0 )
(1.0, 0.0, 0.016666666666666607, 1.0)
Using an if-chain like above is actually faster than using elif
Using a wrapper, like in Cyber's answer, takes a few extra steps for the interpreter to perform.
To add, the for loop in Cyber's example is a real performance killer when used like that
If you want slightly more performance, simply do this:
(I won't say this is the best possible performance, but it's certainly better)
scalar = float # a scale value (0.0 to 1.0)
def hsv_to_rgb( h:scalar, s:scalar, v:scalar, a:scalar ) -> tuple:
a = int(255*a)
if s:
if h == 1.0: h = 0.0
i = int(h*6.0); f = h*6.0 - i
w = int(255*( v * (1.0 - s) ))
q = int(255*( v * (1.0 - s * f) ))
t = int(255*( v * (1.0 - s * (1.0 - f)) ))
v = int(255*v)
if i==0: return (v, t, w, a)
if i==1: return (q, v, w, a)
if i==2: return (w, v, t, a)
if i==3: return (w, q, v, a)
if i==4: return (t, w, v, a)
if i==5: return (v, w, q, a)
else: v = int(255*v); return (v, v, v, a)
^ this guarantees int() output with a range of 255 (the input is still the same)
>>> hsv_to_rgb( 359/360.0, 1.0, 1.0, 1.0 )
(255, 0, 4, 255)
NOTE: this code tests just as accurate as colorsys to GIMP (99% correct):

TIP: stay away from 3rd-party where possible, try the direct approach if you can.
exculusions: compiled C extensions such as PIL or NumPy, or ctypes wrappers such as PyOpenGL (uses the DLL)