def _structure_block_size_type(block_size, dtype):
    """
    The block_size's type Union[int, List[int], Tuple[int, ...]] need a custom structure hook
    for attrs yaml conversion.

    Note the `dtype` parameter is not used but required by attrs interface.
    """
    if isinstance(block_size, int):
        return block_size
    else:
        if not isinstance(block_size, (list, tuple)):
            raise ValueError(
                f'"block_size" must be int or list/tuple of int. Got {type(block_size)}'
            )
        return block_size

    The block_size's type Union[int, List[int], Tuple[int, ...]] need a custom structure hook
    for attrs yaml conversion.

    Note the `dtype` parameter is not used but required by attrs interface.
    
coremltools/optimize/coreml/_config.py