'Starts a new background task.
token      -- token from login() call, all tasks require tokens
role_name  -- used to check token against authn/authz layers
thr_obj_fn -- function handle to run in a background thread
name       -- display name to show in logs/events
args       -- usually this is a single dict, containing options
on_done    -- an optional second function handle to run after success (and only success)
Returns a task id.'

def __start_task(self, thr_obj_fn, token, role_name, name, args, on_done=None):

    self.check_access(token, role_name)
    event_id = self.__generate_event_id(role_name)
    event_id = str(event_id)
    self.events[event_id] = [float(time.time()), str(name), EVENT_RUNNING, []]
    self._log(('start_task(%s);    event_id(%s)' % (name, event_id)))
    logatron = clogger.Logger(('/var/log/cobbler/tasks/%s.log' % event_id))
    thr_obj = CobblerThread(event_id, self, logatron, args, role_name, self.api)
    on_done_type = type(thr_obj.on_done)
    thr_obj._run = thr_obj_fn
    if (on_done is not None):
        thr_obj.on_done = on_done_type(on_done, thr_obj, CobblerThread)
    thr_obj.start()
    return event_id
