def hsv_to_rgb(h, s, v):
if s == <NUM_LIT:0>: return v, v, v<EOL>h = h / (<NUM_LIT> / <NUM_LIT>)<EOL>i = floor(h)<EOL>f = h - i<EOL>p = v * (<NUM_LIT:1> - s)<EOL>q = v * (<NUM_LIT:1> - s * f)<EOL>t = v * (<NUM_LIT:1> - s * (<NUM_LIT:1> - f))<EOL>if i == <NUM_LIT:0>:<EOL><INDENT>r = v;<EOL>g = t;<EOL>b = p<EOL><DEDENT>elif i == <NUM_LIT:1>:<EOL><INDENT>r = q;<EOL>g = v;<EOL>b = p<EOL><DEDENT>elif i == <NUM_LIT:2>:<EOL><INDENT>r = p;<EOL>g = v;<EOL>b = t<EOL><DEDENT>elif i == <NUM_LIT:3>:<EOL><INDENT>r = p;<EOL>g = q;<EOL>b = v<EOL><DEDENT>elif i == <NUM_LIT:4>:<EOL><INDENT>r = t;<EOL>g = p;<EOL>b = v<EOL><DEDENT>else:<EOL><INDENT>r = v;<EOL>g = p;<EOL>b = q<EOL><DEDENT>return r, g, b<EOL>
Hue, saturation, brightness to red, green, blue.
    http://www.koders.com/python/fidB2FE963F658FE74D9BF74EB93EFD44DCAE45E10E.aspx
    Results will differ from the way NSColor converts color spaces.