




import inspect
import logging
import os
import random
import shutil
import tempfile
import unittest

import pytest
import torch
from torch import nn
from torch.utils.data import DataLoader, TensorDataset

from accelerate import Accelerator
from accelerate.test_utils import execute_subprocess_async, require_cuda
from accelerate.utils import ProjectConfiguration, set_seed


SCREAMING_SNAKE_CASE__     :     Any		    =       logging.getLogger(__name__)

def lowercase    (  SCREAMING_SNAKE_CASE=2       ,    SCREAMING_SNAKE_CASE=3       ,    SCREAMING_SNAKE_CASE=16       ,    SCREAMING_SNAKE_CASE = 10       ,    SCREAMING_SNAKE_CASE = 2 )			->							Union[str, Any]:


			'''simple docstring'''







			def get_dataset(SCREAMING_SNAKE_CASE ):
						SCREAMING_SNAKE_CASE_								=						torch.randn(batch_size * n_batches       ,    1 )
						return TensorDataset(SCREAMING_SNAKE_CASE       ,    a * x + b + 0.1 * torch.randn(batch_size * n_batches       ,    1 ) )

			SCREAMING_SNAKE_CASE_								=						get_dataset(SCREAMING_SNAKE_CASE )
			SCREAMING_SNAKE_CASE_								=						get_dataset(SCREAMING_SNAKE_CASE )
			SCREAMING_SNAKE_CASE_								=						DataLoader(SCREAMING_SNAKE_CASE       ,    shuffle=SCREAMING_SNAKE_CASE       ,    batch_size=SCREAMING_SNAKE_CASE       ,    num_workers=4 )
			SCREAMING_SNAKE_CASE_								=						DataLoader(SCREAMING_SNAKE_CASE       ,    shuffle=SCREAMING_SNAKE_CASE       ,    batch_size=SCREAMING_SNAKE_CASE       ,    num_workers=4 )
			return (train_dataloader, valid_dataloader)

def lowercase    (  SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE=None )			->							int:


			'''simple docstring'''







			SCREAMING_SNAKE_CASE_								=						[]
			for epoch in range(SCREAMING_SNAKE_CASE ):
						# Train quickly
						model.train()
						for batch in dataloader:
									SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						batch
									SCREAMING_SNAKE_CASE_								=						model(SCREAMING_SNAKE_CASE )
									SCREAMING_SNAKE_CASE_								=						torch.nn.functional.mse_loss(SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE )
									accelerator.backward(SCREAMING_SNAKE_CASE )
									optimizer.step()
									optimizer.zero_grad()
						rands.append(random.random() )  # Introduce some randomness
						if scheduler is not None:
									scheduler.step()
			return rands



class       a_       (     nn.Module     ):





	def __init__(							self      )  ->					Any:




				"""simple docstring"""



				super().__init__()
				SCREAMING_SNAKE_CASE_								=						nn.Parameter(torch.randn(1      )      )
				SCREAMING_SNAKE_CASE_								=						nn.Parameter(torch.randn(1      )      )





	def 						A_(							self      ,     SCREAMING_SNAKE_CASE      )  ->					str:




				"""simple docstring"""



				return x * self.a + self.b




class       a_       (     unittest.TestCase     ):





	def 						A_(							self      )  ->					Optional[int]:




				"""simple docstring"""



				with tempfile.TemporaryDirectory() as tmpdir:
							set_seed(42      )
							SCREAMING_SNAKE_CASE_								=						DummyModel()
							SCREAMING_SNAKE_CASE_								=						torch.optim.Adam(params=model.parameters()      ,     lr=1e-3      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						dummy_dataloaders()
							SCREAMING_SNAKE_CASE_								=						ProjectConfiguration(total_limit=1      ,     project_dir=SCREAMING_SNAKE_CASE      ,     automatic_checkpoint_naming=SCREAMING_SNAKE_CASE      )
							# Train baseline
							SCREAMING_SNAKE_CASE_								=						Accelerator(project_config=SCREAMING_SNAKE_CASE      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						accelerator.prepare(
							    SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							# Save initial
							accelerator.save_state()

							# Save second state
							accelerator.save_state()
							self.assertEqual(len(os.listdir(accelerator.project_dir      )      )      ,     1      )





	def 						A_(							self      )  ->					Tuple:




				"""simple docstring"""



				with tempfile.TemporaryDirectory() as tmpdir:
							set_seed(42      )
							SCREAMING_SNAKE_CASE_								=						DummyModel()
							SCREAMING_SNAKE_CASE_								=						torch.optim.Adam(params=model.parameters()      ,     lr=1e-3      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						dummy_dataloaders()
							# Train baseline
							SCREAMING_SNAKE_CASE_								=						Accelerator()
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						accelerator.prepare(
							    SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							# Save initial
							SCREAMING_SNAKE_CASE_								=						os.path.join(SCREAMING_SNAKE_CASE      ,     'initial'      )
							accelerator.save_state(SCREAMING_SNAKE_CASE      )
							((SCREAMING_SNAKE_CASE_)						,		(SCREAMING_SNAKE_CASE_))								=						model.a.item(), model.b.item()
							SCREAMING_SNAKE_CASE_								=						optimizer.state_dict()
							SCREAMING_SNAKE_CASE_								=						train(3      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							((SCREAMING_SNAKE_CASE_)						,		(SCREAMING_SNAKE_CASE_))								=						model.a.item(), model.b.item()
							SCREAMING_SNAKE_CASE_								=						optimizer.state_dict()

							# Train partially
							set_seed(42      )
							SCREAMING_SNAKE_CASE_								=						DummyModel()
							SCREAMING_SNAKE_CASE_								=						torch.optim.Adam(params=model.parameters()      ,     lr=1e-3      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						dummy_dataloaders()
							SCREAMING_SNAKE_CASE_								=						Accelerator()
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						accelerator.prepare(
							    SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							accelerator.load_state(SCREAMING_SNAKE_CASE      )
							((SCREAMING_SNAKE_CASE_)						,		(SCREAMING_SNAKE_CASE_))								=						model.a.item(), model.b.item()
							SCREAMING_SNAKE_CASE_								=						optimizer.state_dict()
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )

							SCREAMING_SNAKE_CASE_								=						train(2      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							# Save everything
							SCREAMING_SNAKE_CASE_								=						os.path.join(SCREAMING_SNAKE_CASE      ,     'checkpoint'      )
							accelerator.save_state(SCREAMING_SNAKE_CASE      )

							# Load everything back in and make sure all states work
							accelerator.load_state(SCREAMING_SNAKE_CASE      )
							test_rands += train(1      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							((SCREAMING_SNAKE_CASE_)						,		(SCREAMING_SNAKE_CASE_))								=						model.a.item(), model.b.item()
							SCREAMING_SNAKE_CASE_								=						optimizer.state_dict()
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )





	def 						A_(							self      )  ->					Tuple:




				"""simple docstring"""



				with tempfile.TemporaryDirectory() as tmpdir:
							set_seed(42      )
							SCREAMING_SNAKE_CASE_								=						DummyModel()
							SCREAMING_SNAKE_CASE_								=						torch.optim.Adam(params=model.parameters()      ,     lr=1e-3      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						dummy_dataloaders()
							SCREAMING_SNAKE_CASE_								=						ProjectConfiguration(automatic_checkpoint_naming=SCREAMING_SNAKE_CASE      )

							# Train baseline
							SCREAMING_SNAKE_CASE_								=						Accelerator(project_dir=SCREAMING_SNAKE_CASE      ,     project_config=SCREAMING_SNAKE_CASE      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						accelerator.prepare(
							    SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							# Save initial
							accelerator.save_state()
							((SCREAMING_SNAKE_CASE_)						,		(SCREAMING_SNAKE_CASE_))								=						model.a.item(), model.b.item()
							SCREAMING_SNAKE_CASE_								=						optimizer.state_dict()
							SCREAMING_SNAKE_CASE_								=						train(3      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							((SCREAMING_SNAKE_CASE_)						,		(SCREAMING_SNAKE_CASE_))								=						model.a.item(), model.b.item()
							SCREAMING_SNAKE_CASE_								=						optimizer.state_dict()

							# Train partially
							set_seed(42      )
							SCREAMING_SNAKE_CASE_								=						DummyModel()
							SCREAMING_SNAKE_CASE_								=						torch.optim.Adam(params=model.parameters()      ,     lr=1e-3      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						dummy_dataloaders()
							SCREAMING_SNAKE_CASE_								=						ProjectConfiguration(iteration=1      ,     automatic_checkpoint_naming=SCREAMING_SNAKE_CASE      )
							SCREAMING_SNAKE_CASE_								=						Accelerator(project_dir=SCREAMING_SNAKE_CASE      ,     project_config=SCREAMING_SNAKE_CASE      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						accelerator.prepare(
							    SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							accelerator.load_state(os.path.join(SCREAMING_SNAKE_CASE      ,     'checkpoints'      ,     'checkpoint_0'      )      )
							((SCREAMING_SNAKE_CASE_)						,		(SCREAMING_SNAKE_CASE_))								=						model.a.item(), model.b.item()
							SCREAMING_SNAKE_CASE_								=						optimizer.state_dict()
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )

							SCREAMING_SNAKE_CASE_								=						train(2      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							# Save everything
							accelerator.save_state()

							# Load everything back in and make sure all states work
							accelerator.load_state(os.path.join(SCREAMING_SNAKE_CASE      ,     'checkpoints'      ,     'checkpoint_1'      )      )
							test_rands += train(1      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							((SCREAMING_SNAKE_CASE_)						,		(SCREAMING_SNAKE_CASE_))								=						model.a.item(), model.b.item()
							SCREAMING_SNAKE_CASE_								=						optimizer.state_dict()
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )





	def 						A_(							self      )  ->					Optional[int]:




				"""simple docstring"""



				SCREAMING_SNAKE_CASE_								=						torch.tensor([1, 2, 3]      )
				SCREAMING_SNAKE_CASE_								=						torch.tensor([2, 3, 4]      )
				SCREAMING_SNAKE_CASE_								=						DummyModel()
				SCREAMING_SNAKE_CASE_								=						torch.optim.Adam(net.parameters()      )
				SCREAMING_SNAKE_CASE_								=						Accelerator()
				with self.assertRaises(SCREAMING_SNAKE_CASE      ) as ve:
							accelerator.register_for_checkpointing(SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
				SCREAMING_SNAKE_CASE_								=						str(ve.exception      )
				self.assertTrue('Item at index 0' in message      )
				self.assertTrue('Item at index 1' in message      )
				self.assertFalse('Item at index 2' in message      )
				self.assertFalse('Item at index 3' in message      )





	def 						A_(							self      )  ->					Tuple:




				"""simple docstring"""



				with tempfile.TemporaryDirectory() as tmpdir:
							set_seed(42      )
							SCREAMING_SNAKE_CASE_								=						DummyModel()
							SCREAMING_SNAKE_CASE_								=						torch.optim.Adam(params=model.parameters()      ,     lr=1e-3      )
							SCREAMING_SNAKE_CASE_								=						torch.optim.lr_scheduler.StepLR(SCREAMING_SNAKE_CASE      ,     step_size=1      ,     gamma=0.9_9      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						dummy_dataloaders()
							SCREAMING_SNAKE_CASE_								=						ProjectConfiguration(automatic_checkpoint_naming=SCREAMING_SNAKE_CASE      )
							# Train baseline
							SCREAMING_SNAKE_CASE_								=						Accelerator(project_dir=SCREAMING_SNAKE_CASE      ,     project_config=SCREAMING_SNAKE_CASE      )
							SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_								=						accelerator.prepare(
							    SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							# Save initial
							accelerator.save_state()
							SCREAMING_SNAKE_CASE_								=						scheduler.state_dict()
							train(3      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      ,     SCREAMING_SNAKE_CASE      )
							self.assertNotEqual(SCREAMING_SNAKE_CASE      ,     scheduler.state_dict()      )

							# Load everything back in and make sure all states work
							accelerator.load_state(os.path.join(SCREAMING_SNAKE_CASE      ,     'checkpoints'      ,     'checkpoint_0'      )      )
							self.assertEqual(SCREAMING_SNAKE_CASE      ,     scheduler.state_dict()      )





	def 						A_(							self      )  ->					List[str]:




				"""simple docstring"""



				with tempfile.TemporaryDirectory() as tmpdir:
							set_seed(42      )
							SCREAMING_SNAKE_CASE_								=						DummyModel()
							SCREAMING_SNAKE_CASE_								=						ProjectConfiguration(automatic_checkpoint_naming=SCREAMING_SNAKE_CASE      ,     total_limit=2      )
							# Train baseline
							SCREAMING_SNAKE_CASE_								=						Accelerator(project_dir=SCREAMING_SNAKE_CASE      ,     project_config=SCREAMING_SNAKE_CASE      )
							SCREAMING_SNAKE_CASE_								=						accelerator.prepare(SCREAMING_SNAKE_CASE      )
							# Save 3 states:
							for _ in range(11      ):
										accelerator.save_state()
							self.assertTrue(not os.path.exists(os.path.join(SCREAMING_SNAKE_CASE      ,     'checkpoints'      ,     'checkpoint_0'      )      )      )
							self.assertTrue(os.path.exists(os.path.join(SCREAMING_SNAKE_CASE      ,     'checkpoints'      ,     'checkpoint_9'      )      )      )
							self.assertTrue(os.path.exists(os.path.join(SCREAMING_SNAKE_CASE      ,     'checkpoints'      ,     'checkpoint_10'      )      )      )





	@require_cuda
	def 						A_(							self      )  ->					int:




				"""simple docstring"""



				SCREAMING_SNAKE_CASE_								=						['torchrun', f'--nproc_per_node={torch.cuda.device_count()}', inspect.getfile(self.__class__      )]
				execute_subprocess_async(SCREAMING_SNAKE_CASE      ,     env=os.environ.copy()      )


if __name__ == "__main__":
				SCREAMING_SNAKE_CASE__     :     List[Any]		    =       "/tmp/accelerate/state_checkpointing"
				SCREAMING_SNAKE_CASE__     :     Any		    =       DummyModel()
				SCREAMING_SNAKE_CASE__     :     Optional[Any]		    =       torch.optim.Adam(params=model.parameters(), lr=1E-3)
				SCREAMING_SNAKE_CASE__     :     str		    =       torch.optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=0.99)
				SCREAMING_SNAKE_CASE__    ,						SCREAMING_SNAKE_CASE__     :     List[Any]		    =       dummy_dataloaders()
				SCREAMING_SNAKE_CASE__     :     str		    =       ProjectConfiguration(automatic_checkpoint_naming=True)
				# Train baseline
				SCREAMING_SNAKE_CASE__     :     Optional[Any]		    =       Accelerator(project_dir=savedir, project_config=project_config, mixed_precision="no")
				if accelerator.process_index == 0:
								if os.path.exists(savedir):
												shutil.rmtree(savedir)
								os.makedirs(savedir)
				SCREAMING_SNAKE_CASE__    ,						SCREAMING_SNAKE_CASE__    ,						SCREAMING_SNAKE_CASE__    ,						SCREAMING_SNAKE_CASE__    ,						SCREAMING_SNAKE_CASE__     :     List[Any]		    =       accelerator.prepare(
				    model, optimizer, train_dataloader, valid_dataloader, scheduler
				)
				SCREAMING_SNAKE_CASE__    ,						SCREAMING_SNAKE_CASE__     :     str		    =       accelerator.prepare(model, optimizer)
				train(3, model, train_dataloader, optimizer, accelerator, scheduler)
				# Check that the intial optimizer is loaded on the GPU
				for group in optimizer.param_groups:
								SCREAMING_SNAKE_CASE__     :     Union[str, Any]		    =       group["params"][0].device
								break
				assert param_device.type == accelerator.device.type
				SCREAMING_SNAKE_CASE__     :     List[Any]		    =       model.cpu()
				accelerator.wait_for_everyone()
				accelerator.save_state()
				accelerator.wait_for_everyone()

				# Check CPU state
				accelerator.load_state(os.path.join(savedir, "checkpoints", "checkpoint_0"), map_location="cpu")
				for group in optimizer.param_groups:
								SCREAMING_SNAKE_CASE__     :     Tuple		    =       group["params"][0].device
								break
				assert (
				    param_device.type == torch.device("cpu").type
				), f"Loaded optimizer states did not match, expected to be loaded on the CPU but got {param_device}"

				# Check device state
				model.to(accelerator.device)
				accelerator.load_state(os.path.join(savedir, "checkpoints", "checkpoint_0"), map_location="on_device")
				for group in optimizer.param_groups:
								SCREAMING_SNAKE_CASE__     :     Any		    =       group["params"][0].device
								break
				assert (
				    param_device.type == accelerator.device.type
				), f"Loaded optimizer states did not match, expected to be loaded on {accelerator.device} but got {param_device}"

				# Check error
				with pytest.raises(TypeError, match="Unsupported optimizer map location passed"):
								accelerator.load_state(os.path.join(savedir, "checkpoints", "checkpoint_0"), map_location="invalid")
				accelerator.wait_for_everyone()
				if accelerator.process_index == 0:
								shutil.rmtree(savedir)
				accelerator.wait_for_everyone()






import qiskit

def lowercase    (  SCREAMING_SNAKE_CASE = 2 )			->							qiskit.result.counts.Counts:


			'''simple docstring'''







			SCREAMING_SNAKE_CASE_								=						qubits

			# Using Aer's simulator
			SCREAMING_SNAKE_CASE_								=						qiskit.Aer.get_backend('aer_simulator' )

			# Creating a Quantum Circuit acting on the q register
			SCREAMING_SNAKE_CASE_								=						qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE )

			# Adding a H gate on qubit 0 (now q0 in superposition)
			circuit.h(0 )

			for i in range(1       ,    SCREAMING_SNAKE_CASE ):
						# Adding CX (CNOT) gate
						circuit.cx(i - 1       ,    SCREAMING_SNAKE_CASE )

			# Mapping the quantum measurement to the classical bits
			circuit.measure(list(range(SCREAMING_SNAKE_CASE ) )       ,    list(range(SCREAMING_SNAKE_CASE ) ) )

			# Now measuring any one qubit would affect other qubits to collapse
			# their super position and have same state as the measured one.

			# Executing the circuit on the simulator
			SCREAMING_SNAKE_CASE_								=						qiskit.execute(SCREAMING_SNAKE_CASE       ,    SCREAMING_SNAKE_CASE       ,    shots=10_00 )

			return job.result().get_counts(SCREAMING_SNAKE_CASE )


if __name__ == "__main__":
				print(f"""Total count for various states are: {quantum_entanglement(3)}""")
