






import math



def  a__ (__lowercase							:float					,  __lowercase							:float   )		-> float:

				if initial_intensity < 0:
								raise ValueError('''The value of intensity cannot be negative'''   )
								# handling of negative values of initial intensity
				if angle < 0 or angle > 360:
								raise ValueError('''In Malus Law, the angle is in the range 0-360 degrees'''   )
								# handling of values out of allowed range
				return initial_intensity * (math.cos(math.radians(__lowercase   )   ) ** 2)


if __name__ == "__main__":
	import doctest

	doctest.testmod(name='malus_law')











from PIL import Image



def  a__ (__lowercase							:Image					,  __lowercase							:float   )		-> Image:

				def brightness(__lowercase							:int   ) -> float:
								return 128 + level + (c - 128)

				if not -255.0 <= level <= 255.0:
								raise ValueError('''level must be between -255.0 (black) and 255.0 (white)'''   )
				return img.point(__lowercase   )


if __name__ == "__main__":
	# Load image
	with Image.open('image_data/lena.jpg') as img:
		# Change brightness to 100
		_UpperCamelCase			:	Any								=change_brightness(img, 100)
		brigt_img.save('image_data/lena_brightness.png', format='png')



