def check_block_size(instance, attr, block_size):
    """
    Validator for block_size.

    Note the `instance` and `attr` are not used but required by attrs interface.
    """
    if block_size is not None:
        if isinstance(block_size, int):
            if block_size < 0:
                raise ValueError(
                    f"The block_size must be non-negative values, but got {block_size}"
                )
        elif isinstance(block_size, (list, tuple)):
            for it_block_size in block_size:
                if not isinstance(it_block_size, int) or it_block_size < 0:
                    raise ValueError("All values in block_size must be non-negative values.")
        else:
            raise ValueError(
                f"The block_size should be int or list/tuple of int, but got {type(block_size)}."
            )

    Validator for block_size.

    Note the `instance` and `attr` are not used but required by attrs interface.
    
coremltools/optimize/coreml/_config.py