




"""simple docstring"""




def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					):
			if hue < 0 or hue > 3_60:
						raise Exception('''hue should be between 0 and 360'''					)

			if saturation < 0 or saturation > 1:
						raise Exception('''saturation should be between 0 and 1'''					)

			if value < 0 or value > 1:
						raise Exception('''value should be between 0 and 1'''					)

			__lowercase	:       str				=   value * saturation
			__lowercase	:       Tuple				=   hue / 60
			__lowercase	:       Optional[int]				=   chroma * (1 - abs(hue_section % 2 - 1					))
			__lowercase	:       Union[str, Any]				=   value - chroma

			if hue_section >= 0 and hue_section <= 1:
						__lowercase	:       Tuple				=   round(2_55 * (chroma + match_value)					)
						__lowercase	:       Any				=   round(2_55 * (second_largest_component + match_value)					)
						__lowercase	:       List[str]				=   round(2_55 * (match_value)					)
			elif hue_section > 1 and hue_section <= 2:
						__lowercase	:       str				=   round(2_55 * (second_largest_component + match_value)					)
						__lowercase	:       List[Any]				=   round(2_55 * (chroma + match_value)					)
						__lowercase	:       str				=   round(2_55 * (match_value)					)
			elif hue_section > 2 and hue_section <= 3:
						__lowercase	:       Any				=   round(2_55 * (match_value)					)
						__lowercase	:       int				=   round(2_55 * (chroma + match_value)					)
						__lowercase	:       Optional[int]				=   round(2_55 * (second_largest_component + match_value)					)
			elif hue_section > 3 and hue_section <= 4:
						__lowercase	:       Dict				=   round(2_55 * (match_value)					)
						__lowercase	:       Optional[int]				=   round(2_55 * (second_largest_component + match_value)					)
						__lowercase	:       List[Any]				=   round(2_55 * (chroma + match_value)					)
			elif hue_section > 4 and hue_section <= 5:
						__lowercase	:       Optional[Any]				=   round(2_55 * (second_largest_component + match_value)					)
						__lowercase	:       Optional[int]				=   round(2_55 * (match_value)					)
						__lowercase	:       Optional[Any]				=   round(2_55 * (chroma + match_value)					)
			else:
						__lowercase	:       str				=   round(2_55 * (chroma + match_value)					)
						__lowercase	:       str				=   round(2_55 * (match_value)					)
						__lowercase	:       Optional[int]				=   round(2_55 * (second_largest_component + match_value)					)

			return [red, green, blue]







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					):
			if red < 0 or red > 2_55:
						raise Exception('''red should be between 0 and 255'''					)

			if green < 0 or green > 2_55:
						raise Exception('''green should be between 0 and 255'''					)

			if blue < 0 or blue > 2_55:
						raise Exception('''blue should be between 0 and 255'''					)

			__lowercase	:       Dict				=   red / 2_55
			__lowercase	:       Any				=   green / 2_55
			__lowercase	:       Union[str, Any]				=   blue / 2_55
			__lowercase	:       Dict				=   max(__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					)
			__lowercase	:       Optional[Any]				=   value - min(__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					)
			__lowercase	:       List[str]				=   0 if value == 0 else chroma / value

			if chroma == 0:
						__lowercase	:       Optional[int]				=   0.0
			elif value == float_red:
						__lowercase	:       List[str]				=   60 * (0 + (float_green - float_blue) / chroma)
			elif value == float_green:
						__lowercase	:       Optional[Any]				=   60 * (2 + (float_blue - float_red) / chroma)
			else:
						__lowercase	:       str				=   60 * (4 + (float_red - float_green) / chroma)

			__lowercase	:       List[str]				=   (hue + 3_60) % 3_60

			return [hue, saturation, value]







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					):
			__lowercase	:       Dict				=   abs(hsv_a[0] - hsv_a[0]					) < 0.2
			__lowercase	:       Any				=   abs(hsv_a[1] - hsv_a[1]					) < 0.002
			__lowercase	:       Union[str, Any]				=   abs(hsv_a[2] - hsv_a[2]					) < 0.002

			return check_hue and check_saturation and check_value









"""simple docstring"""




def       __UpperCAmelCase      (				__UpperCamelCase					):
			if len(__UpperCamelCase					) <= 1:
						return data
			else:
						return [
						    *quick_sort([e for e in data[1:] if e <= data[0]]					),
						    data[0],
						    *quick_sort([e for e in data[1:] if e > data[0]]					),
						]


if __name__ == "__main__":
			import doctest

			doctest.testmod()



