code: 
  import gc
  import random
  import tempfile
  import unittest
  
  import numpy as np
  import torch
  from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
  
  from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel
  from diffusers.pipelines.semantic_stable_diffusion import SemanticStableDiffusionPipeline as StableDiffusionPipeline
  from diffusers.utils import floats_tensor, nightly, torch_device
  from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu
  
  
  enable_full_determinism()
  
  
  
  
  
  class      UpperCamelCase_			(			unittest.TestCase		):
  
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :List[Any]    )     ->Dict:
  										# clean up the VRAM after each test
  										super().tearDown()
  										gc.collect()
  										torch.cuda.empty_cache()
  
  
  
  
  
  						@property
  						def 					SCREAMING_SNAKE_CASE( self       :Optional[Any]    )     ->Optional[Any]:
  										lowercase						    =			1
  										lowercase						    =			3
  										lowercase						    =			(32, 32)
  
  										lowercase						    =			floats_tensor((batch_size, num_channels) + sizes		,						rng=random.Random(0    )    ).to(lowerCAmelCase__    )
  										return image
  
  
  
  
  
  						@property
  						def 					SCREAMING_SNAKE_CASE( self       :Optional[int]    )     ->Tuple:
  										torch.manual_seed(0    )
  										lowercase						    =			UNetaDConditionModel(
  										    block_out_channels=(32, 64)		,						layers_per_block=2		,						sample_size=32		,						in_channels=4		,						out_channels=4		,						down_block_types=("DownBlock2D", "CrossAttnDownBlock2D")		,						up_block_types=("CrossAttnUpBlock2D", "UpBlock2D")		,						cross_attention_dim=32		,						)
  										return model
  
  
  
  
  
  						@property
  						def 					SCREAMING_SNAKE_CASE( self       :str    )     ->Dict:
  										torch.manual_seed(0    )
  										lowercase						    =			AutoencoderKL(
  										    block_out_channels=[32, 64]		,						in_channels=3		,						out_channels=3		,						down_block_types=["DownEncoderBlock2D", "DownEncoderBlock2D"]		,						up_block_types=["UpDecoderBlock2D", "UpDecoderBlock2D"]		,						latent_channels=4		,						)
  										return model
  
  
  
  
  
  						@property
  						def 					SCREAMING_SNAKE_CASE( self       :Optional[int]    )     ->Union[str, Any]:
  										torch.manual_seed(0    )
  										lowercase						    =			CLIPTextConfig(
  										    bos_token_id=0		,						eos_token_id=2		,						hidden_size=32		,						intermediate_size=37		,						layer_norm_eps=1E-0_5		,						num_attention_heads=4		,						num_hidden_layers=5		,						pad_token_id=1		,						vocab_size=1000		,						)
  										return CLIPTextModel(lowerCAmelCase__    )
  
  
  
  
  
  						@property
  						def 					SCREAMING_SNAKE_CASE( self       :Any    )     ->Union[str, Any]:
  										def extract(*lowerCAmelCase__       :List[Any]		,						**lowerCAmelCase__       :int    ):
  
  
  
  
  
  														class      UpperCamelCase_			:
  
  
  
  
  
  
  
  																				'''simple docstring'''
  
  
  
  																				def __init__( self       :Optional[int]    )     ->List[Any]:
  																								lowercase						    =			torch.ones([0]    )
  
  
  
  
  
  																				def 					SCREAMING_SNAKE_CASE( self       :str		,						lowerCAmelCase__       :List[Any]    )     ->List[str]:
  																								self.pixel_values.to(lowerCAmelCase__    )
  																								return self
  
  
  
  
  														return Out()
  
  										return extract
  
  
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :Any    )     ->Dict:
  										lowercase						    =			"cpu"  # ensure determinism for the device-dependent torch.Generator
  										lowercase						    =			self.dummy_cond_unet
  										lowercase						    =			DDIMScheduler(
  										    beta_start=0.0_00_85		,						beta_end=0.0_12		,						beta_schedule="scaled_linear"		,						clip_sample=lowerCAmelCase__		,						set_alpha_to_one=lowerCAmelCase__		,						)
  
  										lowercase						    =			self.dummy_vae
  										lowercase						    =			self.dummy_text_encoder
  										lowercase						    =			CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip"    )
  
  										# make sure here that pndm scheduler skips prk
  										lowercase						    =			StableDiffusionPipeline(
  										    unet=lowerCAmelCase__		,						scheduler=lowerCAmelCase__		,						vae=lowerCAmelCase__		,						text_encoder=lowerCAmelCase__		,						tokenizer=lowerCAmelCase__		,						safety_checker=lowerCAmelCase__		,						feature_extractor=self.dummy_extractor		,						)
  										lowercase						    =			sd_pipe.to(lowerCAmelCase__    )
  										sd_pipe.set_progress_bar_config(disable=lowerCAmelCase__    )
  
  										lowercase						    =			"A painting of a squirrel eating a burger"
  
  										lowercase						    =			torch.Generator(device=lowerCAmelCase__    ).manual_seed(0    )
  										lowercase						    =			sd_pipe([prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=6.0		,						num_inference_steps=2		,						output_type="np"    )
  										lowercase						    =			output.images
  
  										lowercase						    =			torch.Generator(device=lowerCAmelCase__    ).manual_seed(0    )
  										lowercase						    =			sd_pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=6.0		,						num_inference_steps=2		,						output_type="np"		,						return_dict=lowerCAmelCase__		,						)[0]
  
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			image_from_tuple[0, -3:, -3:, -1]
  
  										assert image.shape == (1, 64, 64, 3)
  										lowercase						    =			np.array([0.57_53, 0.61_14, 0.50_01, 0.50_34, 0.54_70, 0.47_29, 0.49_71, 0.48_67, 0.48_67]    )
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  										assert np.abs(image_from_tuple_slice.flatten() - expected_slice    ).max() < 1E-2
  
  
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :List[str]    )     ->Union[str, Any]:
  										lowercase						    =			"cpu"  # ensure determinism for the device-dependent torch.Generator
  										lowercase						    =			self.dummy_cond_unet
  										lowercase						    =			PNDMScheduler(skip_prk_steps=lowerCAmelCase__    )
  										lowercase						    =			self.dummy_vae
  										lowercase						    =			self.dummy_text_encoder
  										lowercase						    =			CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip"    )
  
  										# make sure here that pndm scheduler skips prk
  										lowercase						    =			StableDiffusionPipeline(
  										    unet=lowerCAmelCase__		,						scheduler=lowerCAmelCase__		,						vae=lowerCAmelCase__		,						text_encoder=lowerCAmelCase__		,						tokenizer=lowerCAmelCase__		,						safety_checker=lowerCAmelCase__		,						feature_extractor=self.dummy_extractor		,						)
  										lowercase						    =			sd_pipe.to(lowerCAmelCase__    )
  										sd_pipe.set_progress_bar_config(disable=lowerCAmelCase__    )
  
  										lowercase						    =			"A painting of a squirrel eating a burger"
  										lowercase						    =			torch.Generator(device=lowerCAmelCase__    ).manual_seed(0    )
  										lowercase						    =			sd_pipe([prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=6.0		,						num_inference_steps=2		,						output_type="np"    )
  
  										lowercase						    =			output.images
  
  										lowercase						    =			torch.Generator(device=lowerCAmelCase__    ).manual_seed(0    )
  										lowercase						    =			sd_pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=6.0		,						num_inference_steps=2		,						output_type="np"		,						return_dict=lowerCAmelCase__		,						)[0]
  
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			image_from_tuple[0, -3:, -3:, -1]
  
  										assert image.shape == (1, 64, 64, 3)
  										lowercase						    =			np.array([0.51_22, 0.57_12, 0.48_25, 0.50_53, 0.56_46, 0.47_69, 0.51_79, 0.48_94, 0.49_94]    )
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  										assert np.abs(image_from_tuple_slice.flatten() - expected_slice    ).max() < 1E-2
  
  
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :Optional[Any]    )     ->Any:
  										lowercase						    =			StableDiffusionPipeline.from_pretrained(
  										    "hf-internal-testing/tiny-stable-diffusion-lms-pipe"		,						safety_checker=lowerCAmelCase__    )
  										assert isinstance(lowerCAmelCase__		,						lowerCAmelCase__    )
  										assert isinstance(pipe.scheduler		,						lowerCAmelCase__    )
  										assert pipe.safety_checker is None
  
  										lowercase						    =			pipe("example prompt"		,						num_inference_steps=2    ).images[0]
  										assert image is not None
  
  										# check that there's no error when saving a pipeline with one of the models being None
  										with tempfile.TemporaryDirectory() as tmpdirname:
  														pipe.save_pretrained(lowerCAmelCase__    )
  														lowercase						    =			StableDiffusionPipeline.from_pretrained(lowerCAmelCase__    )
  
  										# sanity check that the pipeline still works
  										assert pipe.safety_checker is None
  										lowercase						    =			pipe("example prompt"		,						num_inference_steps=2    ).images[0]
  										assert image is not None
  
  
  
  
  
  						@unittest.skipIf(torch_device != "cuda"		,						"This test requires a GPU"    )
  						def 					SCREAMING_SNAKE_CASE( self       :Dict    )     ->Optional[int]:
  										lowercase						    =			self.dummy_cond_unet
  										lowercase						    =			PNDMScheduler(skip_prk_steps=lowerCAmelCase__    )
  										lowercase						    =			self.dummy_vae
  										lowercase						    =			self.dummy_text_encoder
  										lowercase						    =			CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip"    )
  
  										# put models in fp16
  										lowercase						    =			unet.half()
  										lowercase						    =			vae.half()
  										lowercase						    =			bert.half()
  
  										# make sure here that pndm scheduler skips prk
  										lowercase						    =			StableDiffusionPipeline(
  										    unet=lowerCAmelCase__		,						scheduler=lowerCAmelCase__		,						vae=lowerCAmelCase__		,						text_encoder=lowerCAmelCase__		,						tokenizer=lowerCAmelCase__		,						safety_checker=lowerCAmelCase__		,						feature_extractor=self.dummy_extractor		,						)
  										lowercase						    =			sd_pipe.to(lowerCAmelCase__    )
  										sd_pipe.set_progress_bar_config(disable=lowerCAmelCase__    )
  
  										lowercase						    =			"A painting of a squirrel eating a burger"
  										lowercase						    =			sd_pipe([prompt]		,						num_inference_steps=2		,						output_type="np"    ).images
  
  										assert image.shape == (1, 64, 64, 3)
  
  
  
  
  
  @nightly
  @require_torch_gpu
  class      UpperCamelCase_			(			unittest.TestCase		):
  
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :List[Any]    )     ->Optional[int]:
  										# clean up the VRAM after each test
  										super().tearDown()
  										gc.collect()
  										torch.cuda.empty_cache()
  
  
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :List[Any]    )     ->Tuple:
  										lowercase						    =			"cuda"
  										lowercase						    =			StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5"    )
  										lowercase						    =			pipe.to(lowerCAmelCase__    )
  										pipe.set_progress_bar_config(disable=lowerCAmelCase__    )
  
  										lowercase						    =			"a photo of a cat"
  										lowercase						    =			{
  										    "editing_prompt": ["sunglasses"],
  										    "reverse_editing_direction": [False],
  										    "edit_warmup_steps": 10,
  										    "edit_guidance_scale": 6,
  										    "edit_threshold": 0.95,
  										    "edit_momentum_scale": 0.5,
  										    "edit_mom_beta": 0.6,
  										}
  
  										lowercase						    =			3
  										lowercase						    =			7
  
  										# no sega enabled
  										lowercase						    =			torch.Generator(lowerCAmelCase__    )
  										generator.manual_seed(lowerCAmelCase__    )
  										lowercase						    =			pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=lowerCAmelCase__		,						num_inference_steps=50		,						output_type="np"		,						width=512		,						height=512		,						)
  
  										lowercase						    =			output.images
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			[
  										    0.34_67_31_13,
  										    0.38_49_27_33,
  										    0.37_59_73_52,
  										    0.34_08_63_35,
  										    0.35_65_07_48,
  										    0.35_57_92_05,
  										    0.3_38_47_63,
  										    0.34_34_02_36,
  										    0.3_57_32_71,
  										]
  
  										assert image.shape == (1, 512, 512, 3)
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  
  										# with sega enabled
  										# generator = torch.manual_seed(seed)
  										generator.manual_seed(lowerCAmelCase__    )
  										lowercase						    =			pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=lowerCAmelCase__		,						num_inference_steps=50		,						output_type="np"		,						width=512		,						height=512		,						**lowerCAmelCase__		,						)
  
  										lowercase						    =			output.images
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			[
  										    0.41_88_78_26,
  										    0.37_72_87_66,
  										    0.30_13_82_72,
  										    0.41_41_63_35,
  										    0.41_66_49_85,
  										    0.36_28_33_92,
  										    0.36_19_12_46,
  										    0.43_36_44_65,
  										    0.43_00_17_32,
  										]
  
  										assert image.shape == (1, 512, 512, 3)
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  
  
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :Dict    )     ->Tuple:
  										lowercase						    =			"cuda"
  										lowercase						    =			StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5"    )
  										lowercase						    =			pipe.to(lowerCAmelCase__    )
  										pipe.set_progress_bar_config(disable=lowerCAmelCase__    )
  
  										lowercase						    =			"an image of a crowded boulevard, realistic, 4k"
  										lowercase						    =			{
  										    "editing_prompt": "crowd, crowded, people",
  										    "reverse_editing_direction": True,
  										    "edit_warmup_steps": 10,
  										    "edit_guidance_scale": 8.3,
  										    "edit_threshold": 0.9,
  										    "edit_momentum_scale": 0.5,
  										    "edit_mom_beta": 0.6,
  										}
  
  										lowercase						    =			9
  										lowercase						    =			7
  
  										# no sega enabled
  										lowercase						    =			torch.Generator(lowerCAmelCase__    )
  										generator.manual_seed(lowerCAmelCase__    )
  										lowercase						    =			pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=lowerCAmelCase__		,						num_inference_steps=50		,						output_type="np"		,						width=512		,						height=512		,						)
  
  										lowercase						    =			output.images
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			[
  										    0.43_49_79_98,
  										    0.91_81_40_65,
  										    0.7_54_07_39,
  										    0.55_58_02_05,
  										    0.8_46_72_65,
  										    0.5_38_96_91,
  										    0.62_57_45_06,
  										    0.58_89_77_63,
  										    0.50_92_67_57,
  										]
  
  										assert image.shape == (1, 512, 512, 3)
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  
  										# with sega enabled
  										# generator = torch.manual_seed(seed)
  										generator.manual_seed(lowerCAmelCase__    )
  										lowercase						    =			pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=lowerCAmelCase__		,						num_inference_steps=50		,						output_type="np"		,						width=512		,						height=512		,						**lowerCAmelCase__		,						)
  
  										lowercase						    =			output.images
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			[
  										    0.3_08_97_19,
  										    0.30_50_01_44,
  										    0.29_01_60_42,
  										    0.30_63_09_64,
  										    0.32_56_87,
  										    0.29_41_92_25,
  										    0.2_90_80_91,
  										    0.28_72_35_98,
  										    0.27_69_62_94,
  										]
  
  										assert image.shape == (1, 512, 512, 3)
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  
  
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :List[str]    )     ->Tuple:
  										lowercase						    =			"cuda"
  										lowercase						    =			StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5"    )
  										lowercase						    =			pipe.to(lowerCAmelCase__    )
  										pipe.set_progress_bar_config(disable=lowerCAmelCase__    )
  
  										lowercase						    =			"a castle next to a river"
  										lowercase						    =			{
  										    "editing_prompt": ["boat on a river, boat", "monet, impression, sunrise"],
  										    "reverse_editing_direction": False,
  										    "edit_warmup_steps": [15, 18],
  										    "edit_guidance_scale": 6,
  										    "edit_threshold": [0.9, 0.8],
  										    "edit_momentum_scale": 0.5,
  										    "edit_mom_beta": 0.6,
  										}
  
  										lowercase						    =			48
  										lowercase						    =			7
  
  										# no sega enabled
  										lowercase						    =			torch.Generator(lowerCAmelCase__    )
  										generator.manual_seed(lowerCAmelCase__    )
  										lowercase						    =			pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=lowerCAmelCase__		,						num_inference_steps=50		,						output_type="np"		,						width=512		,						height=512		,						)
  
  										lowercase						    =			output.images
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			[
  										    0.75_16_35_55,
  										    0.76_03_71_45,
  										    0.6_17_85,
  										    0.9_18_96_73,
  										    0.8_62_77_01,
  										    0.85_18_96_94,
  										    0.8_51_28_13,
  										    0.87_01_20_76,
  										    0.8_31_28_57,
  										]
  
  										assert image.shape == (1, 512, 512, 3)
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  
  										# with sega enabled
  										# generator = torch.manual_seed(seed)
  										generator.manual_seed(lowerCAmelCase__    )
  										lowercase						    =			pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=lowerCAmelCase__		,						num_inference_steps=50		,						output_type="np"		,						width=512		,						height=512		,						**lowerCAmelCase__		,						)
  
  										lowercase						    =			output.images
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			[
  										    0.73_55_33_65,
  										    0.7_53_72_71,
  										    0.74_34_19_05,
  										    0.66_48_03_56,
  										    0.6_47_29_25,
  										    0.63_03_94_16,
  										    0.64_81_29_05,
  										    0.6_74_97_17,
  										    0.6_51_71_02,
  										]
  
  										assert image.shape == (1, 512, 512, 3)
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  
  
  
  
  
  						def 					SCREAMING_SNAKE_CASE( self       :Dict    )     ->Optional[int]:
  										lowercase						    =			"cuda"
  										lowercase						    =			StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5"		,						torch_dtype=torch.floataa    )
  										lowercase						    =			pipe.to(lowerCAmelCase__    )
  										pipe.set_progress_bar_config(disable=lowerCAmelCase__    )
  
  										lowercase						    =			"a photo of a cat"
  										lowercase						    =			{
  										    "editing_prompt": ["sunglasses"],
  										    "reverse_editing_direction": [False],
  										    "edit_warmup_steps": 10,
  										    "edit_guidance_scale": 6,
  										    "edit_threshold": 0.95,
  										    "edit_momentum_scale": 0.5,
  										    "edit_mom_beta": 0.6,
  										}
  
  										lowercase						    =			3
  										lowercase						    =			7
  
  										# no sega enabled
  										lowercase						    =			torch.Generator(lowerCAmelCase__    )
  										generator.manual_seed(lowerCAmelCase__    )
  										lowercase						    =			pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=lowerCAmelCase__		,						num_inference_steps=50		,						output_type="np"		,						width=512		,						height=512		,						)
  
  										lowercase						    =			output.images
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			[
  										    0.34_88_76_95,
  										    0.3_87_69_53,
  										    0.3_75,
  										    0.34_42_38_28,
  										    0.3_58_15_43,
  										    0.35_71_77_73,
  										    0.3_38_37_89,
  										    0.34_57_03_12,
  										    0.35_93_75,
  										]
  
  										assert image.shape == (1, 512, 512, 3)
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  
  										# with sega enabled
  										# generator = torch.manual_seed(seed)
  										generator.manual_seed(lowerCAmelCase__    )
  										lowercase						    =			pipe(
  										    [prompt]		,						generator=lowerCAmelCase__		,						guidance_scale=lowerCAmelCase__		,						num_inference_steps=50		,						output_type="np"		,						width=512		,						height=512		,						**lowerCAmelCase__		,						)
  
  										lowercase						    =			output.images
  										lowercase						    =			image[0, -3:, -3:, -1]
  										lowercase						    =			[
  										    0.42_28_51_56,
  										    0.36_91_40_62,
  										    0.29_07_71_48,
  										    0.42_04_10_16,
  										    0.41_91_89_45,
  										    0.35_49_80_47,
  										    0.3_61_81_64,
  										    0.4_42_38_28,
  										    0.43_11_52_34,
  										]
  
  										assert image.shape == (1, 512, 512, 3)
  
  										assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
  
style_context: 
  _snake_case			:       List[Any]      =						{
      "A": ("ABCDEFGHIJKLM", "NOPQRSTUVWXYZ"),
      "B": ("ABCDEFGHIJKLM", "NOPQRSTUVWXYZ"),
      "C": ("ABCDEFGHIJKLM", "ZNOPQRSTUVWXY"),
      "D": ("ABCDEFGHIJKLM", "ZNOPQRSTUVWXY"),
      "E": ("ABCDEFGHIJKLM", "YZNOPQRSTUVWX"),
      "F": ("ABCDEFGHIJKLM", "YZNOPQRSTUVWX"),
      "G": ("ABCDEFGHIJKLM", "XYZNOPQRSTUVW"),
      "H": ("ABCDEFGHIJKLM", "XYZNOPQRSTUVW"),
      "I": ("ABCDEFGHIJKLM", "WXYZNOPQRSTUV"),
      "J": ("ABCDEFGHIJKLM", "WXYZNOPQRSTUV"),
      "K": ("ABCDEFGHIJKLM", "VWXYZNOPQRSTU"),
      "L": ("ABCDEFGHIJKLM", "VWXYZNOPQRSTU"),
      "M": ("ABCDEFGHIJKLM", "UVWXYZNOPQRST"),
      "N": ("ABCDEFGHIJKLM", "UVWXYZNOPQRST"),
      "O": ("ABCDEFGHIJKLM", "TUVWXYZNOPQRS"),
      "P": ("ABCDEFGHIJKLM", "TUVWXYZNOPQRS"),
      "Q": ("ABCDEFGHIJKLM", "STUVWXYZNOPQR"),
      "R": ("ABCDEFGHIJKLM", "STUVWXYZNOPQR"),
      "S": ("ABCDEFGHIJKLM", "RSTUVWXYZNOPQ"),
      "T": ("ABCDEFGHIJKLM", "RSTUVWXYZNOPQ"),
      "U": ("ABCDEFGHIJKLM", "QRSTUVWXYZNOP"),
      "V": ("ABCDEFGHIJKLM", "QRSTUVWXYZNOP"),
      "W": ("ABCDEFGHIJKLM", "PQRSTUVWXYZNO"),
      "X": ("ABCDEFGHIJKLM", "PQRSTUVWXYZNO"),
      "Y": ("ABCDEFGHIJKLM", "OPQRSTUVWXYZN"),
      "Z": ("ABCDEFGHIJKLM", "OPQRSTUVWXYZN"),
  }
  
  def    __snake_case       (  __magic_name__	):
  
  
  
  
  
  
  
  				'''simple docstring'''
  
  
  				return [alphabet[char] for char in key.upper()]
  
  def    __snake_case       (  __magic_name__		,						__magic_name__	):
  
  
  
  
  
  
  
  				'''simple docstring'''
  
  
  				lowercase						    =			""
  				lowercase						    =			0
  				lowercase						    =			generate_table(__magic_name__	)
  				for char in words.upper():
  								cipher += get_opponent(table[count]		,						__magic_name__	)
  								lowercase						    =			(count + 1) % len(__magic_name__	)
  				return cipher
  
  def    __snake_case       (  __magic_name__		,						__magic_name__	):
  
  
  
  
  
  
  
  				'''simple docstring'''
  
  
  				return encrypt(__magic_name__		,						__magic_name__	)
  
  def    __snake_case       (  __magic_name__		,						__magic_name__	):
  
  
  
  
  
  
  
  				'''simple docstring'''
  
  
  				lowercase						    =			0 if char in table[0] else 1
  				lowercase						    =			table[row].index(__magic_name__	)
  				return row, col
  
  def    __snake_case       (  __magic_name__		,						__magic_name__	):
  
  
  
  
  
  
  
  				'''simple docstring'''
  
  
  				lowercase    ,  lowercase						    =			get_position(__magic_name__		,						char.upper()	)
  				if row == 1:
  								return table[0][col]
  				else:
  								return table[1][col] if row == 0 else char
  
  
  if __name__ == "__main__":
  						import doctest
  
  						doctest.testmod()  # Fist ensure that all our tests are passing...
  						_snake_case			:       List[Any]      =						input("Enter key: ").strip()
  						_snake_case			:       Optional[int]      =						input("Enter text to encrypt: ").strip()
  						_snake_case			:       Optional[Any]      =						encrypt(key, text)
  
  						print(F"Encrypted: {cipher_text}")
  						print(F"Decrypted with key: {decrypt(key, cipher_text)}")
  