copy_attr function

Copy attributes from one object to another