code: def add_all(cls, models, commit=True, check_type=False):
          
          if check_type:
              for model in models:
                  if not isinstance(model, cls):
                      raise ValueError('%s is not of type %s' (model, cls))
          if None in models:
              cls.session.add_all([m for m in models if m is not None])
          else:
              cls.session.add_all(models)
          try:
              if commit:
                  cls.session.commit()
              return models
          except:
              cls.session.rollback()
              raise
docs: Batch method for adding a list of model instances
          to the db in one get_or_404.
  
          Args:
  
              models (list): A list of the instances to add.
              commit (bool, optional): Defaults to True. If False, the
                  transaction won't get committed.
              check_type (bool, optional) :  If True, each instance
                  is type checked and exception is thrown if it is
                  not an instance of the model. By default, False.
  
          Returns:
              list: A list of `Model` instances