



'''simple docstring'''

from math import ceil



def 	__lowerCamelCase	( lowerCAmelCase_		,     lowerCAmelCase_    )     -> List[str]:
		_a	: Optional[Any]								=				list(range(0		,     _lowercase    )    )

		_a	: Dict								=				[item for sublist in list(device_map.values()    ) for item in sublist]

		# Duplicate check
		_a	: Dict								=				[]
		for i in device_map_blocks:
				if device_map_blocks.count(_lowercase    ) > 1 and i not in duplicate_blocks:
						duplicate_blocks.append(_lowercase    )
    # Missing blocks
		_a	: List[str]								=				[i for i in blocks if i not in device_map_blocks]
		_a	: Optional[int]								=				[i for i in device_map_blocks if i not in blocks]

		if len(_lowercase    ) != 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(_lowercase    )    )
		if len(_lowercase    ) != 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(_lowercase    )    )
		if len(_lowercase    ) != 0:
				raise ValueError(
				    'The device_map contains more attention blocks than this model has. Remove these from the device_map:'
				    + str(_lowercase    )    )



def 	__lowerCamelCase	( lowerCAmelCase_		,     lowerCAmelCase_    )     -> List[Any]:
		_a	: Optional[int]								=				list(range(_lowercase    )    )
		_a	: Dict								=				int(ceil(n_layers / len(_lowercase    )    )    )
		_a	: List[Any]								=				[layers[i : i + n_blocks] for i in range(0		,     _lowercase		,     _lowercase    )]

		return dict(zip(_lowercase		,     _lowercase    )    )











def       SCREAMING_SNAKE_CASE__  (       _lowercase     : str			)   ->							str:




		'''simple docstring'''
		if not all(char in '01' for char in bin_string			):
				raise ValueError('Non-binary value was passed to the function'			)
		if not bin_string:
				raise ValueError('Empty string was passed to the function'			)
		lowercase__					:      Tuple      =		''
		while len(_lowercase			) % 3 != 0:
				lowercase__					:      Optional[int]      =		'0' + bin_string
		lowercase__					:      List[Any]      =		[
		    bin_string[index : index + 3]
		    for index in range(len(_lowercase			)			)
		    if index % 3 == 0
		]
		for bin_group in bin_string_in_3_list:
				lowercase__					:      int      =		0
				for index, val in enumerate(_lowercase			):
						oct_val += int(2 ** (2 - index) * int(_lowercase			)			)
				oct_string += str(_lowercase			)
		return oct_string


if __name__ == "__main__":
			from doctest import testmod

			testmod()


