def HSVtoRGB(h, s, v):
  """ Convert Hue-Saturation-Value into Red-Green-Blue equivalent.

      Parameters:
        h   - Hue between [0.0, 360.0) degrees. red(0.0) to violet(360.0-).
        s   - Staturation [0.0, 1.0]
        v   - Value [0.0, 1.0]

      Return Value:
        (r, g, b) 3-tuple with each color between [0, 255]
  """
  # achromatic (grey)
  if s == 0.0:
    r = g = b = int(v * 255)
    return (r, g, b)

  # sector 0 to 5
  h /= 60.0
  i = int(h)    # hue whole part
  f = h - i     # hue fraction part of h
  p = v * (1.0 - s)
  q = v * (1.0 - s * f)
  t = v * (1.0 - s * (1.0 - f ))

  if i == 0:
    r = int(v * 255.0)
    g = int(t * 255.0)
    b = int(p * 255.0)
  elif i == 1:
    r = int(q * 255.0)
    g = int(v * 255.0)
    b = int(p * 255.0)
  elif i == 2:
    r = int(p * 255.0)
    g = int(v * 255.0)
    b = int(t * 255.0)
  elif i == 3:
    r = int(p * 255.0)
    g = int(q * 255.0)
    b = int(v * 255.0)
  elif i == 4:
    r = int(t * 255.0)
    g = int(p * 255.0)
    b = int(v * 255.0)
  else: # sector 5
    r = int(v * 255.0)
    g = int(p * 255.0)
    b = int(q * 255.0)

  return (r, g, b)