'''simple docstring'''






import logging
import os

from .state import PartialState




class    a (       logging.LoggerAdapter				):



  """simple docstring"""







  @staticmethod
  def    lowercase_  (							snake_case_					):

    '''simple docstring'''







    __UpperCAmelCase:					Any		= PartialState()
    return not main_process_only or (main_process_only and state.is_main_process)







  def    lowercase_  (							self   ,    snake_case_   ,    snake_case_   ,    *snake_case_   ,    **snake_case_					):

    '''simple docstring'''







    if PartialState._shared_state == {}:
      raise RuntimeError(
          """You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility."""					)
    __UpperCAmelCase:					Tuple		= kwargs.pop("""main_process_only"""   ,    snake_case_					)
    __UpperCAmelCase:					Any		= kwargs.pop("""in_order"""   ,    snake_case_					)

    if self.isEnabledFor(snake_case_					):
      if self._should_log(snake_case_					):
        __UpperCAmelCase, __UpperCAmelCase:					Any		= self.process(snake_case_   ,    snake_case_					)
        self.logger.log(snake_case_   ,    snake_case_   ,    *snake_case_   ,    **snake_case_					)

      elif in_order:
        __UpperCAmelCase:					str		= PartialState()
        for i in range(state.num_processes					):
          if i == state.process_index:
            __UpperCAmelCase, __UpperCAmelCase:					Union[str, Any]		= self.process(snake_case_   ,    snake_case_					)
            self.logger.log(snake_case_   ,    snake_case_   ,    *snake_case_   ,    **snake_case_					)
          state.wait_for_everyone()






def  UpperCamelCase__					(					_lowercase    :				str   ,    _lowercase    :				str = None     )							->	List[Any]:
  if log_level is None:
    __UpperCAmelCase:					Union[str, Any]		= os.environ.get("""ACCELERATE_LOG_LEVEL"""   ,    _lowercase     )
  __UpperCAmelCase:					str		= logging.getLogger(_lowercase     )
  if log_level is not None:
    logger.setLevel(log_level.upper()     )
    logger.root.setLevel(log_level.upper()     )
  return MultiProcessAdapter(_lowercase   ,    {}     )
'''simple docstring'''






import itertools
import math






def  UpperCamelCase__					(					_lowercase    :				int     )							->	bool:

  if 1 < number < 4:
    # 2 and 3 are primes
    return True
  elif number < 2 or number % 2 == 0 or number % 3 == 0:
    # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
    return False

  # All primes number are in format of 6k +/- 1
  for i in range(5   ,    int(math.sqrt(_lowercase     ) + 1     )   ,    6     ):
    if number % i == 0 or number % (i + 2) == 0:
      return False
  return True






def  UpperCamelCase__					(					)							->	Optional[int]:
  __UpperCAmelCase:					Union[str, Any]		= 2
  while True:
    if is_prime(_lowercase     ):
      yield num
    num += 1






def  UpperCamelCase__					(					_lowercase    :				int = 1_0_0_0_1     )							->	int:
  return next(itertools.islice(prime_generator()   ,    nth - 1   ,    _lowercase     )     )


if __name__ == "__main__":
    print(F"""{solution() = }""")