'Delete a schedule'

@api.response(200, description=u'Schedule    deleted', model=base_message_schema)
def delete(self, schedule_id, session=None):

    schedules = self.manager.config.get(u'schedules')
    if (schedules is True):
        raise Conflict(u'Schedules    usage    is    set    to    default,    cannot    delete')
    elif (schedules is False):
        raise Conflict(u'Schedules    are    disables    in    config')
    for i in range(len(self.manager.config.get(u'schedules', []))):
        if (id(self.manager.config[u'schedules'][i]) == schedule_id):
            del self.manager.config[u'schedules'][i]
            self.manager.save_config()
            self.manager.config_changed()
            return success_response((u'schedule    %d    successfully    deleted' % schedule_id))
    raise NotFoundError((u'schedule    %d    not    found' % schedule_id))
