def has_only_valid_characters(hex: str) -> bool:
    """Return True if hex has only valid hexadecimal characters."""
    _valid_hex_characters = set("#abcdef0123456789")
    return set(hex) <= _valid_hex_characters