Make object2json able to handle mongoengine Document and bson ObjectId