



import math
from collections import defaultdict
from typing import List, Optional, Tuple, Union

import numpy as np
import torch

from ..configuration_utils import ConfigMixin, register_to_config
from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput






def 	_lowerCAmelCase						(				__lowerCamelCase   :     Optional[int]		,	__lowerCamelCase   :     Any=0.999		,	__lowerCamelCase   :     List[Any]="cosine"		,	):



 """simple docstring"""





 if alpha_transform_type == "cosine":

  def alpha_bar_fn(__lowerCamelCase   :     Optional[Any]     ):
   return math.cos((t + 0.008) / 1.008 * math.pi / 2     ) ** 2

 elif alpha_transform_type == "exp":

  def alpha_bar_fn(__lowerCamelCase   :     Union[str, Any]     ):
   return math.exp(t * -12.0     )

 else:
  raise ValueError(F"""Unsupported alpha_tranform_type: {alpha_transform_type}"""     )

 __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	[]
 for i in range(__lowerCamelCase     ):
  __SCREAMING_SNAKE_CASE       :    str       =	i / num_diffusion_timesteps
  __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	(i + 1) / num_diffusion_timesteps
  betas.append(min(1 - alpha_bar_fn(__lowerCamelCase     ) / alpha_bar_fn(__lowerCamelCase     )		,	__lowerCamelCase     )     )
 return torch.tensor(__lowerCamelCase		,	dtype=torch.floataa     )






class       _SCREAMING_SNAKE_CASE	(__UpperCamelCase			,    __UpperCamelCase ):
     lowerCAmelCase					=			[e.name for e in KarrasDiffusionSchedulers]
     lowerCAmelCase					=			2





     @register_to_config
     def __init__(       self :							Union[str, Any]     ,  UpperCamelCase :							int = 1_0_0_0     ,  UpperCamelCase :							float = 0.0_0_0_8_5     ,  UpperCamelCase :							float = 0.0_1_2     ,  UpperCamelCase :							str = "linear"     ,  UpperCamelCase :							Optional[Union[np.ndarray, List[float]]] = None     ,  UpperCamelCase :							str = "epsilon"     ,  UpperCamelCase :							str = "linspace"     ,  UpperCamelCase :							int = 0     ,  )->Any:
      if trained_betas is not None:
       __SCREAMING_SNAKE_CASE       :    Dict       =	torch.tensor(UpperCamelCase     ,  dtype=torch.floataa				)
      elif beta_schedule == "linear":
       __SCREAMING_SNAKE_CASE       :    Optional[int]       =	torch.linspace(UpperCamelCase     ,  UpperCamelCase     ,  UpperCamelCase     ,  dtype=torch.floataa				)
      elif beta_schedule == "scaled_linear":
       # this schedule is very specific to the latent diffusion model.
       __SCREAMING_SNAKE_CASE       :    Dict       =	(
           torch.linspace(beta_start**0.5     ,  beta_end**0.5     ,  UpperCamelCase     ,  dtype=torch.floataa				) ** 2
       )
      elif beta_schedule == "squaredcos_cap_v2":
       # Glide cosine schedule
       __SCREAMING_SNAKE_CASE       :    str       =	betas_for_alpha_bar(UpperCamelCase				)
      else:
       raise NotImplementedError(F"""{beta_schedule} does is not implemented for {self.__class__}"""				)

      __SCREAMING_SNAKE_CASE       :    Dict       =	1.0 - self.betas
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	torch.cumprod(self.alphas     ,  dim=0				)

      #  set all values
      self.set_timesteps(UpperCamelCase     ,  UpperCamelCase     ,  UpperCamelCase				)





     def 	__snake_case    (       self :							Any     ,  UpperCamelCase :							int     ,  UpperCamelCase :							List[Any]=None				)->List[Any]:
      if schedule_timesteps is None:
       __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	self.timesteps

      __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	(schedule_timesteps == timestep).nonzero()

      # The sigma index that is taken for the **very** first `step`
      # is always the second index (or the last index if there is only 1)
      # This way we can ensure we don't accidentally skip a sigma in
      # case we start in the middle of the denoising schedule (e.g. for image-to-image)
      if len(self._index_counter				) == 0:
       __SCREAMING_SNAKE_CASE       :    Tuple       =	1 if len(UpperCamelCase				) > 1 else 0
      else:
       __SCREAMING_SNAKE_CASE       :    Dict       =	timestep.cpu().item() if torch.is_tensor(UpperCamelCase				) else timestep
       __SCREAMING_SNAKE_CASE       :    int       =	self._index_counter[timestep_int]

      return indices[pos].item()





     @property
     def 	__snake_case    (       self :							List[str]				)->Union[str, Any]:
      # standard deviation of the initial noise distribution
      if self.config.timestep_spacing in ["linspace", "trailing"]:
       return self.sigmas.max()

      return (self.sigmas.max() ** 2 + 1) ** 0.5





     def 	__snake_case    (       self :							List[str]     ,  UpperCamelCase :							torch.FloatTensor     ,  UpperCamelCase :							Union[float, torch.FloatTensor]     ,  )->torch.FloatTensor:
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	self.index_for_timestep(UpperCamelCase				)

      if self.state_in_first_order:
       __SCREAMING_SNAKE_CASE       :    str       =	self.sigmas[step_index]
      else:
       __SCREAMING_SNAKE_CASE       :    List[str]       =	self.sigmas_interpol[step_index]

      __SCREAMING_SNAKE_CASE       :    List[Any]       =	sample / ((sigma**2 + 1) ** 0.5)
      return sample





     def 	__snake_case    (       self :							int     ,  UpperCamelCase :							int     ,  UpperCamelCase :							Union[str, torch.device] = None     ,  UpperCamelCase :							Optional[int] = None     ,  )->Any:
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	num_inference_steps

      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	num_train_timesteps or self.config.num_train_timesteps

      # "linspace", "leading", "trailing" corresponds to annotation of Table 2. of https://arxiv.org/abs/2305.08891
      if self.config.timestep_spacing == "linspace":
       __SCREAMING_SNAKE_CASE       :    Tuple       =	np.linspace(0     ,  num_train_timesteps - 1     ,  UpperCamelCase     ,  dtype=UpperCamelCase				)[::-1].copy()
      elif self.config.timestep_spacing == "leading":
       __SCREAMING_SNAKE_CASE       :    Optional[int]       =	num_train_timesteps // self.num_inference_steps
       # creates integer timesteps by multiplying by ratio
       # casting to int to avoid issues when num_inference_step is power of 3
       __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	(np.arange(0     ,  UpperCamelCase				) * step_ratio).round()[::-1].copy().astype(UpperCamelCase				)
       timesteps += self.config.steps_offset
      elif self.config.timestep_spacing == "trailing":
       __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	num_train_timesteps / self.num_inference_steps
       # creates integer timesteps by multiplying by ratio
       # casting to int to avoid issues when num_inference_step is power of 3
       __SCREAMING_SNAKE_CASE       :    Optional[int]       =	(np.arange(UpperCamelCase     ,  0     ,  -step_ratio				)).round().copy().astype(UpperCamelCase				)
       timesteps -= 1
      else:
       raise ValueError(
           F"""{self.config.timestep_spacing} is not supported. Please make sure to choose one of 'linspace', 'leading' or 'trailing'."""				)

      __SCREAMING_SNAKE_CASE       :    Any       =	np.array(((1 - self.alphas_cumprod) / self.alphas_cumprod) ** 0.5				)
      __SCREAMING_SNAKE_CASE       :    Any       =	torch.from_numpy(np.log(UpperCamelCase				)				).to(UpperCamelCase				)

      __SCREAMING_SNAKE_CASE       :    Any       =	np.interp(UpperCamelCase     ,  np.arange(0     ,  len(UpperCamelCase				)				)     ,  UpperCamelCase				)
      __SCREAMING_SNAKE_CASE       :    Tuple       =	np.concatenate([sigmas, [0.0]]				).astype(np.floataa				)
      __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	torch.from_numpy(UpperCamelCase				).to(device=UpperCamelCase				)

      # interpolate sigmas
      __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	sigmas.log().lerp(sigmas.roll(1				).log()     ,  0.5				).exp()

      __SCREAMING_SNAKE_CASE       :    List[Any]       =	torch.cat([sigmas[:1], sigmas[1:].repeat_interleave(2				), sigmas[-1:]]				)
      __SCREAMING_SNAKE_CASE       :    int       =	torch.cat(
          [sigmas_interpol[:1], sigmas_interpol[1:].repeat_interleave(2				), sigmas_interpol[-1:]]				)

      if str(UpperCamelCase				).startswith("mps"				):
       # mps does not support float64
       __SCREAMING_SNAKE_CASE       :    List[str]       =	torch.from_numpy(UpperCamelCase				).to(UpperCamelCase     ,  dtype=torch.floataa				)
      else:
       __SCREAMING_SNAKE_CASE       :    List[Any]       =	torch.from_numpy(UpperCamelCase				).to(UpperCamelCase				)

      # interpolate timesteps
      __SCREAMING_SNAKE_CASE       :    str       =	self.sigma_to_t(UpperCamelCase				).to(UpperCamelCase     ,  dtype=timesteps.dtype				)
      __SCREAMING_SNAKE_CASE       :    str       =	torch.stack((timesteps_interpol[1:-1, None], timesteps[1:, None])     ,  dim=-1				).flatten()

      __SCREAMING_SNAKE_CASE       :    Tuple       =	torch.cat([timesteps[:1], interleaved_timesteps]				)

      __SCREAMING_SNAKE_CASE       :    str       =	None

      # for exp beta schedules, such as the one for `pipeline_shap_e.py`
      # we need an index counter
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	defaultdict(UpperCamelCase				)





     def 	__snake_case    (       self :							Tuple     ,  UpperCamelCase :							Dict				)->int:
      # get log sigma
      __SCREAMING_SNAKE_CASE       :    List[str]       =	sigma.log()

      # get distribution
      __SCREAMING_SNAKE_CASE       :    Tuple       =	log_sigma - self.log_sigmas[:, None]

      # get sigmas range
      __SCREAMING_SNAKE_CASE       :    Any       =	dists.ge(0				).cumsum(dim=0				).argmax(dim=0				).clamp(max=self.log_sigmas.shape[0] - 2				)
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	low_idx + 1

      __SCREAMING_SNAKE_CASE       :    str       =	self.log_sigmas[low_idx]
      __SCREAMING_SNAKE_CASE       :    Any       =	self.log_sigmas[high_idx]

      # interpolate sigmas
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	(low - log_sigma) / (low - high)
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	w.clamp(0     ,  1				)

      # transform interpolation to time range
      __SCREAMING_SNAKE_CASE       :    Any       =	(1 - w) * low_idx + w * high_idx
      __SCREAMING_SNAKE_CASE       :    Any       =	t.view(sigma.shape				)
      return t





     @property
     def 	__snake_case    (       self :							str				)->Dict:
      return self.sample is None





     def 	__snake_case    (       self :							str     ,  UpperCamelCase :							Union[torch.FloatTensor, np.ndarray]     ,  UpperCamelCase :							Union[float, torch.FloatTensor]     ,  UpperCamelCase :							Union[torch.FloatTensor, np.ndarray]     ,  UpperCamelCase :							bool = True     ,  )->Union[SchedulerOutput, Tuple]:
      __SCREAMING_SNAKE_CASE       :    Dict       =	self.index_for_timestep(UpperCamelCase				)

      # advance index counter by 1
      __SCREAMING_SNAKE_CASE       :    List[str]       =	timestep.cpu().item() if torch.is_tensor(UpperCamelCase				) else timestep
      self._index_counter[timestep_int] += 1

      if self.state_in_first_order:
       __SCREAMING_SNAKE_CASE       :    Tuple       =	self.sigmas[step_index]
       __SCREAMING_SNAKE_CASE       :    str       =	self.sigmas_interpol[step_index + 1]
       __SCREAMING_SNAKE_CASE       :    Dict       =	self.sigmas[step_index + 1]
      else:
       # 2nd order / KDPM2's method
       __SCREAMING_SNAKE_CASE       :    Any       =	self.sigmas[step_index - 1]
       __SCREAMING_SNAKE_CASE       :    int       =	self.sigmas_interpol[step_index]
       __SCREAMING_SNAKE_CASE       :    List[str]       =	self.sigmas[step_index]

      # currently only gamma=0 is supported. This usually works best anyways.
      # We can support gamma in the future but then need to scale the timestep before
      # passing it to the model which requires a change in API
      __SCREAMING_SNAKE_CASE       :    List[str]       =	0
      __SCREAMING_SNAKE_CASE       :    List[str]       =	sigma * (gamma + 1)  # Note: sigma_hat == sigma for now

      # 1. compute predicted original sample (x_0) from sigma-scaled predicted noise
      if self.config.prediction_type == "epsilon":
       __SCREAMING_SNAKE_CASE       :    List[Any]       =	sigma_hat if self.state_in_first_order else sigma_interpol
       __SCREAMING_SNAKE_CASE       :    Optional[int]       =	sample - sigma_input * model_output
      elif self.config.prediction_type == "v_prediction":
       __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	sigma_hat if self.state_in_first_order else sigma_interpol
       __SCREAMING_SNAKE_CASE       :    Tuple       =	model_output * (-sigma_input / (sigma_input**2 + 1) ** 0.5) + (
           sample / (sigma_input**2 + 1)
       )
      elif self.config.prediction_type == "sample":
       raise NotImplementedError("prediction_type not implemented yet: sample"				)
      else:
       raise ValueError(
           F"""prediction_type given as {self.config.prediction_type} must be one of `epsilon`, or `v_prediction`"""				)

      if self.state_in_first_order:
       # 2. Convert to an ODE derivative for 1st order
       __SCREAMING_SNAKE_CASE       :    List[Any]       =	(sample - pred_original_sample) / sigma_hat
       # 3. delta timestep
       __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	sigma_interpol - sigma_hat

       # store for 2nd order step
       __SCREAMING_SNAKE_CASE       :    List[Any]       =	sample
      else:
       # DPM-Solver-2
       # 2. Convert to an ODE derivative for 2nd order
       __SCREAMING_SNAKE_CASE       :    Tuple       =	(sample - pred_original_sample) / sigma_interpol

       # 3. delta timestep
       __SCREAMING_SNAKE_CASE       :    Dict       =	sigma_next - sigma_hat

       __SCREAMING_SNAKE_CASE       :    List[str]       =	self.sample
       __SCREAMING_SNAKE_CASE       :    int       =	None

      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	sample + derivative * dt

      if not return_dict:
       return (prev_sample,)

      return SchedulerOutput(prev_sample=UpperCamelCase				)





     def 	__snake_case    (       self :							Optional[int]     ,  UpperCamelCase :							torch.FloatTensor     ,  UpperCamelCase :							torch.FloatTensor     ,  UpperCamelCase :							torch.FloatTensor     ,  )->torch.FloatTensor:
      # Make sure sigmas and timesteps have the same device and dtype as original_samples
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	self.sigmas.to(device=original_samples.device     ,  dtype=original_samples.dtype				)
      if original_samples.device.type == "mps" and torch.is_floating_point(UpperCamelCase				):
       # mps does not support float64
       __SCREAMING_SNAKE_CASE       :    Optional[int]       =	self.timesteps.to(original_samples.device     ,  dtype=torch.floataa				)
       __SCREAMING_SNAKE_CASE       :    Optional[int]       =	timesteps.to(original_samples.device     ,  dtype=torch.floataa				)
      else:
       __SCREAMING_SNAKE_CASE       :    Optional[int]       =	self.timesteps.to(original_samples.device				)
       __SCREAMING_SNAKE_CASE       :    Dict       =	timesteps.to(original_samples.device				)

      __SCREAMING_SNAKE_CASE       :    Any       =	[self.index_for_timestep(UpperCamelCase     ,  UpperCamelCase				) for t in timesteps]

      __SCREAMING_SNAKE_CASE       :    str       =	sigmas[step_indices].flatten()
      while len(sigma.shape				) < len(original_samples.shape				):
       __SCREAMING_SNAKE_CASE       :    List[Any]       =	sigma.unsqueeze(-1				)

      __SCREAMING_SNAKE_CASE       :    Tuple       =	original_samples + noise * sigma
      return noisy_samples






     def __len__(       self :							int				)->Optional[Any]:
      return self.config.num_train_timesteps











from collections.abc import Generator
from math import sin






def 	_lowerCAmelCase						(				__lowerCamelCase   :     bytes     ):



 """simple docstring"""





 if len(__lowerCamelCase     ) != 32:
  raise ValueError("Input must be of length 32"     )

 __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	b""
 for i in [3, 2, 1, 0]:
  little_endian += string_aa[8 * i : 8 * i + 8]
 return little_endian






def 	_lowerCAmelCase						(				__lowerCamelCase   :     int     ):



 """simple docstring"""





 if i < 0:
  raise ValueError("Input must be non-negative"     )

 __SCREAMING_SNAKE_CASE       :    Any       =	format(__lowerCamelCase		,	"08x"     )[-8:]
 __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	b""
 for i in [3, 2, 1, 0]:
  little_endian_hex += hex_rep[2 * i : 2 * i + 2].encode("utf-8"     )
 return little_endian_hex






def 	_lowerCAmelCase						(				__lowerCamelCase   :     bytes     ):



 """simple docstring"""





 __SCREAMING_SNAKE_CASE       :    Any       =	b""
 for char in message:
  bit_string += format(__lowerCamelCase		,	"08b"     ).encode("utf-8"     )
 __SCREAMING_SNAKE_CASE       :    List[str]       =	format(len(__lowerCamelCase     )		,	"064b"     ).encode("utf-8"     )

 # Pad bit_string to a multiple of 512 chars
 bit_string += b"1"
 while len(__lowerCamelCase     ) % 512 != 448:
  bit_string += b"0"
 bit_string += to_little_endian(start_len[32:]     ) + to_little_endian(start_len[:32]     )

 return bit_string






def 	_lowerCAmelCase						(				__lowerCamelCase   :     bytes     ):



 """simple docstring"""





 if len(__lowerCamelCase     ) % 512 != 0:
  raise ValueError("Input must have length that's a multiple of 512"     )

 for pos in range(0		,	len(__lowerCamelCase     )		,	512     ):
  __SCREAMING_SNAKE_CASE       :    int       =	bit_string[pos : pos + 512]
  __SCREAMING_SNAKE_CASE       :    Tuple       =	[]
  for i in range(0		,	512		,	32     ):
   block_words.append(int(to_little_endian(block[i : i + 32]     )		,	2     )     )
  yield block_words






def 	_lowerCAmelCase						(				__lowerCamelCase   :     int     ):



 """simple docstring"""





 if i < 0:
  raise ValueError("Input must be non-negative"     )

 __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	format(__lowerCamelCase		,	"032b"     )
 __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	""
 for c in i_str:
  new_str += "1" if c == "0" else "0"
 return int(__lowerCamelCase		,	2     )






def 	_lowerCAmelCase						(				__lowerCamelCase   :     int		,	__lowerCamelCase   :     int     ):



 """simple docstring"""





 return (a + b) % 2**32






def 	_lowerCAmelCase						(				__lowerCamelCase   :     int		,	__lowerCamelCase   :     int     ):



 """simple docstring"""





 if i < 0:
  raise ValueError("Input must be non-negative"     )
 if shift < 0:
  raise ValueError("Shift must be non-negative"     )
 return ((i << shift) ^ (i >> (32 - shift))) % 2**32






def 	_lowerCAmelCase						(				__lowerCamelCase   :     bytes     ):



 """simple docstring"""





 __SCREAMING_SNAKE_CASE       :    Tuple       =	preprocess(__lowerCamelCase     )

 __SCREAMING_SNAKE_CASE       :    List[Any]       =	[int(2**32 * abs(sin(i + 1     )     )     ) for i in range(64     )]

 # Starting states
 __SCREAMING_SNAKE_CASE       :    Tuple       =	0X67452301
 __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	0Xefcdab89
 __SCREAMING_SNAKE_CASE       :    Optional[int]       =	0X98badcfe
 __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	0X10325476

 __SCREAMING_SNAKE_CASE       :    List[Any]       =	[
     7,
     12,
     17,
     22,
     7,
     12,
     17,
     22,
     7,
     12,
     17,
     22,
     7,
     12,
     17,
     22,
     5,
     9,
     14,
     20,
     5,
     9,
     14,
     20,
     5,
     9,
     14,
     20,
     5,
     9,
     14,
     20,
     4,
     11,
     16,
     23,
     4,
     11,
     16,
     23,
     4,
     11,
     16,
     23,
     4,
     11,
     16,
     23,
     6,
     10,
     15,
     21,
     6,
     10,
     15,
     21,
     6,
     10,
     15,
     21,
     6,
     10,
     15,
     21,
 ]

 # Process bit string in chunks, each with 16 32-char words
 for block_words in get_block_words(__lowerCamelCase     ):
  __SCREAMING_SNAKE_CASE       :    Any       =	aa
  __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	ba
  __SCREAMING_SNAKE_CASE       :    str       =	ca
  __SCREAMING_SNAKE_CASE       :    Dict       =	da

  # Hash current chunk
  for i in range(64     ):
   if i <= 15:
    # f = (b & c) | (not_32(b) & d)     # Alternate definition for f
    __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	d ^ (b & (c ^ d))
    __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	i
   elif i <= 31:
    # f = (d & b) | (not_32(d) & c)     # Alternate definition for f
    __SCREAMING_SNAKE_CASE       :    int       =	c ^ (d & (b ^ c))
    __SCREAMING_SNAKE_CASE       :    int       =	(5 * i + 1) % 16
   elif i <= 47:
    __SCREAMING_SNAKE_CASE       :    List[str]       =	b ^ c ^ d
    __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	(3 * i + 5) % 16
   else:
    __SCREAMING_SNAKE_CASE       :    Any       =	c ^ (b | not_aa(__lowerCamelCase     ))
    __SCREAMING_SNAKE_CASE       :    str       =	(7 * i) % 16
   __SCREAMING_SNAKE_CASE       :    List[str]       =	(f + a + added_consts[i] + block_words[g]) % 2**32
   __SCREAMING_SNAKE_CASE       :    Dict       =	d
   __SCREAMING_SNAKE_CASE       :    str       =	c
   __SCREAMING_SNAKE_CASE       :    Tuple       =	b
   __SCREAMING_SNAKE_CASE       :    Optional[int]       =	sum_aa(__lowerCamelCase		,	left_rotate_aa(__lowerCamelCase		,	shift_amounts[i]     )     )

  # Add hashed chunk to running total
  __SCREAMING_SNAKE_CASE       :    Dict       =	sum_aa(__lowerCamelCase		,	__lowerCamelCase     )
  __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	sum_aa(__lowerCamelCase		,	__lowerCamelCase     )
  __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	sum_aa(__lowerCamelCase		,	__lowerCamelCase     )
  __SCREAMING_SNAKE_CASE       :    str       =	sum_aa(__lowerCamelCase		,	__lowerCamelCase     )

 __SCREAMING_SNAKE_CASE       :    List[str]       =	reformat_hex(__lowerCamelCase     ) + reformat_hex(__lowerCamelCase     ) + reformat_hex(__lowerCamelCase     ) + reformat_hex(__lowerCamelCase     )
 return digest


if __name__ == "__main__":
      import doctest

      doctest.testmod()






