pub fn write_key_to_vec(key: &Key) -> Result<Vec<u8>, KeyBinaryError>
Serializes a KEY index to bytes.