






'''simple docstring'''


from math import factorial







def 	__magic_name__( _A						,      _A						,      _A					):
						'''simple docstring'''





						if successes > trials:
												raise ValueError("""successes must be lower or equal to trials"""					)
						if trials < 0 or successes < 0:
												raise ValueError("""the function is defined for non-negative integers"""					)
						if not isinstance(_A						,      _A					) or not isinstance(_A						,      _A					):
												raise ValueError("""the function is defined for non-negative integers"""					)
						if not 0 < prob < 1:
												raise ValueError("""prob has to be in range of 1 - 0"""					)
						UpperCamelCase__         = (prob**successes) * ((1 - prob) ** (trials - successes))
						# Calculate the binomial coefficient: n! / k!(n-k)!
						UpperCamelCase__         = float(factorial(_A					)					)
						coefficient /= factorial(_A					) * factorial(trials - successes					)
						return probability * coefficient


if __name__ == "__main__":
					from doctest import testmod

					testmod()
					print('''Probability of 2 successes out of 4 trails''')
					print('''with probability of 0.75 is:''', end=''' ''')
					print(binomial_distribution(2, 4, 0.7_5))








'''simple docstring'''


import inspect
import unittest
class    _SCREAMING_SNAKE_CASE							(		unittest.TestCase	):


			'''simple docstring'''





			def 				A      (   self							:						Tuple			)							->    Any:

									'''simple docstring'''







									try:
															import diffusers  # noqa: F401
									except ImportError:
															assert False







			def 				A      (   self							:						Optional[int]			)							->    Union[str, Any]:

									'''simple docstring'''







									import diffusers
									from diffusers.dependency_versions_table import deps

									UpperCamelCase__         = inspect.getmembers(lowercase ,      inspect.isclass			)

									for cls_name, cls_module in all_classes:
															if "dummy_" in cls_module.__module__:
																					for backend in cls_module._backends:
																											if backend == "k_diffusion":
																																	UpperCamelCase__         = """k-diffusion"""
																											elif backend == "invisible_watermark":
																																	UpperCamelCase__         = """invisible-watermark"""
																											assert backend in deps, f"{backend} is not in the deps table!"
