Turns python objects into mongo objects and vice versa