<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_model(self, model_or_type, id_=None):
 """Deletes a model. :model_or_type: if a model, delete that model. If it is a ModelBase subclass, id_ must be specified, and the associated record is deleted. """

    if not id_:
      constraints = get_model_id_constraints(model_or_type)
    else:
      constraints = get_id_constraints(model_or_type.primary_key_name, id_)
    self.delete(model_or_type.table_name, constraints)

    return model_or_type