rewrite example as doctest