def hsv_to_rgb(h, s=None, v=None):
if type(h) in [list,tuple]:<EOL><INDENT>h, s, v = h<EOL><DEDENT>if s==<NUM_LIT:0>: return (v, v, v)   <EOL>h /= <NUM_LIT><EOL>h = h % <NUM_LIT><EOL>i = int(h)<EOL>f = h - i<EOL>if not(i&<NUM_LIT:1>): f = <NUM_LIT:1>-f     <EOL>m = v * (<NUM_LIT:1.0> - s)<EOL>n = v * (<NUM_LIT:1.0> - (s * f))<EOL>if i==<NUM_LIT:0>: return (v, n, m)<EOL>if i==<NUM_LIT:1>: return (n, v, m)<EOL>if i==<NUM_LIT:2>: return (m, v, n)<EOL>if i==<NUM_LIT:3>: return (m, n, v)<EOL>if i==<NUM_LIT:4>: return (n, m, v)<EOL>return (v, m, n)<EOL>
Convert the color from RGB coordinates to HSV.

    Parameters:
      :h:
        The Hus component value [0...1]
      :s:
        The Saturation component value [0...1]
      :v:
        The Value component [0...1]

    Returns:
      The color as an (r, g, b) tuple in the range:
      r[0...1],
      g[0...1],
      b[0...1]

    >>> hsv_to_rgb(30.0, 1.0, 0.5)
    (0.5, 0.25, 0.0)