fn write_with_opt_paren<T: Display>(
    fmt: &mut Formatter<'_>,
    has_paren: bool,
    obj: T
) -> Result