diffuse color material in python error
TypeError: hsv_to_rgb() takes 3 positional arguments but 4 were given
This error means the function expects 3 values, but you're giving it 4, so it throws an error.
ValueError: bpy_struct: item.attr = val: sequences of dimension 0 should contain 4 items, not 3.
This error tells you that the property expects a sequence of 4 items assigned to it, not 3. This is because diffuse_color holds 4 values: R, G, B and A for Alpha. However, the colorsys.hsv_to_rgb() returns only 3 values, as the function name suggests and as the console displays:
&gt;&gt;&gt; colorsys.hsv_to_rgb(.5, 0.875, 1.0)
(0.125, 1.0, 1.0)

In order to have a sequence compatible with the Blender's property, you have to add the alpha value to that sequence:
mat.diffuse_color = colorsys.hsv_to_rgb(.5, 0.875, 1.0) + (1.0,)

notice the awkward comma in the parentheses - without it Python would confuse it with a float wrapped around in parentheses like in mathematical equations. You only need such awkward comma in single-element tuples.