


lowerCAmelCase       =							'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
def 			_a (      SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		if not isinstance(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ):
				lowercase__            =      f'a bytes-like object is required, not \'{data.__class__.__name__}\''
				raise TypeError(SCREAMING_SNAKE_CASE     )

		lowercase__            =      ''''''.join(bin(SCREAMING_SNAKE_CASE     )[2:].zfill(8     ) for byte in data     )

		lowercase__            =      len(SCREAMING_SNAKE_CASE     ) % 6 != 0

		if padding_needed:
				# The padding that will be added later
				lowercase__            =      B'''=''' * ((6 - len(SCREAMING_SNAKE_CASE     ) % 6) // 2)

				# Append binary_stream with arbitrary binary digits (0's by default) to make its
				# length a multiple of 6.
				binary_stream += "0" * (6 - len(SCREAMING_SNAKE_CASE     ) % 6)
		else:
				lowercase__            =      B''''''

		# Encode every 6 binary digits to their corresponding Base64 character
		return (
		    "".join(
		        B64_CHARSET[int(binary_stream[index : index + 6]						,				2     )]
		        for index in range(0						,				len(SCREAMING_SNAKE_CASE     )						,				6     )     ).encode()
		    + padding
		)
def 			_a (      SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		if not isinstance(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ) and not isinstance(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ):
				lowercase__            =      (
				    '''argument should be a bytes-like object or ASCII string, '''
				    f'not \'{encoded_data.__class__.__name__}\''
				)
				raise TypeError(SCREAMING_SNAKE_CASE     )

		# In case encoded_data is a bytes-like object, make sure it contains only
		# ASCII characters so we convert it to a string object
		if isinstance(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ):
				try:
						lowercase__            =      encoded_data.decode('''utf-8'''     )
				except UnicodeDecodeError:
						raise ValueError('''base64 encoded data should only contain ASCII characters'''     )

		lowercase__            =      encoded_data.count('''='''     )

		# Check if the encoded string contains non base64 characters
		if padding:
				assert all(
				    char in B64_CHARSET for char in encoded_data[:-padding]     ), "Invalid base64 character(s) found."
		else:
				assert all(
				    char in B64_CHARSET for char in encoded_data     ), "Invalid base64 character(s) found."

		# Check the padding
		assert len(SCREAMING_SNAKE_CASE     ) % 4 == 0 and padding < 3, "Incorrect padding"

		if padding:
				# Remove padding if there is one
				lowercase__            =      encoded_data[:-padding]

				lowercase__            =      ''''''.join(
				    bin(B64_CHARSET.index(SCREAMING_SNAKE_CASE     )     )[2:].zfill(6     ) for char in encoded_data     )[: -padding * 2]
		else:
				lowercase__            =      ''''''.join(
				    bin(B64_CHARSET.index(SCREAMING_SNAKE_CASE     )     )[2:].zfill(6     ) for char in encoded_data     )

		lowercase__            =      [
		    int(binary_stream[index : index + 8]						,				2     )
		    for index in range(0						,				len(SCREAMING_SNAKE_CASE     )						,				8     )
		]

		return bytes(SCREAMING_SNAKE_CASE     )


if __name__ == "__main__":
			import doctest

			doctest.testmod()



"""simple docstring"""




from math import ceil





def 							SCREAMING_SNAKE_CASE     (			_lowerCamelCase						:       Union[str, Any]			,_lowerCamelCase						:       Union[str, Any]	)       ->      int:
  _lowerCAmelCase						:       Dict  			=     list(range(0			,_lowerCamelCase	)	)

  _lowerCAmelCase						:       Tuple  			=     [item for sublist in list(device_map.values()	) for item in sublist]

  # Duplicate check
  _lowerCAmelCase						:       Union[str, Any]  			=     []
  for i in device_map_blocks:
    if device_map_blocks.count(_lowerCamelCase	) > 1 and i not in duplicate_blocks:
      duplicate_blocks.append(_lowerCamelCase	)
    # Missing blocks
  _lowerCAmelCase						:       int  			=     [i for i in blocks if i not in device_map_blocks]
  _lowerCAmelCase						:       List[Any]  			=     [i for i in device_map_blocks if i not in blocks]

  if len(_lowerCamelCase	) != 0:
    raise ValueError(
        """Duplicate attention blocks specified in device_map. Attention blocks must be specified to one device."""
        """ These attention blocks were specified more than once: """ + str(_lowerCamelCase	)	)
  if len(_lowerCamelCase	) != 0:
    raise ValueError(
        """There are attention blocks for this model that are not specified in the device_map. Add these attention """
        """blocks to a device on the device_map: """ + str(_lowerCamelCase	)	)
  if len(_lowerCamelCase	) != 0:
    raise ValueError(
        """The device_map contains more attention blocks than this model has. Remove these from the device_map:"""
        + str(_lowerCamelCase	)	)






def 							SCREAMING_SNAKE_CASE     (			_lowerCamelCase						:       int			,_lowerCamelCase						:       Tuple	)       ->      str:
  _lowerCAmelCase						:       Optional[Any]  			=     list(range(_lowerCamelCase	)	)
  _lowerCAmelCase						:       Optional[Any]  			=     int(ceil(n_layers / len(_lowerCamelCase	)	)	)
  _lowerCAmelCase						:       Optional[int]  			=     [layers[i : i + n_blocks] for i in range(0			,_lowerCamelCase			,_lowerCamelCase	)]

  return dict(zip(_lowerCamelCase			,_lowerCamelCase	)	)




