merged add_attribute and add_example

those two functions had the exact same content. No need to have two of
these.