def varget(name, defval=None, task=None):
    '''
    Access a task local variable by name

    Precondition:
        If task is None, this must be called from task context
    '''
    taskdict = _taskdict(task)
    retn = taskdict.get(name, s_common.NoValu)
    if retn is not s_common.NoValu:
        return retn

    func = _TaskDictCtors.get(name)
    if func is None:
        return defval

    item = func()
    taskdict[name] = item

    return item
Access a task local variable by name

    Precondition:
        If task is None, this must be called from task context