code: def create(self, instance):
          
          with self.flushing():
              if instance.id is None:
                  instance.id = self.new_object_id()
              self.session.add(instance)
          return instance
docs: Create a new model instance.