<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_unit(unit_id, **kwargs):
 """ Delete a unit from the DB. Raises and exception if the unit does not exist """


    try:
        db_unit = db.DBSession.query(Unit).filter(Unit.id==unit_id).one()

        db.DBSession.delete(db_unit)
        db.DBSession.flush()
        return True
    except NoResultFound:
        raise ResourceNotFoundError("Unit (ID=%s) does not exist"%(unit_id))