def validate_entropy(entropy: bytes) ->None:
    """
    Error if entropy is not valid
    """
    if not isinstance(entropy, bytes):
        raise ValueError('Entropy must be bytes.')
    if len(entropy) not in [16, 20, 24, 28, 32]:
        raise ValueError('Entropy must be 16, 20, 24, 28, or 32 bytes.')
