pub fn serialize<S>(
    algorithm: &Algorithm,
    serializer: S
) -> Result<S::Ok, S::Error> where
    S: Serializer