def task(*args, **kwargs):
    
    if len(args) == 1:

        func = args[0]

        if isinstance(func, Task):
            return func

        elif isinstance(func, types.FunctionType):
            return Task(func)

        # Compat to old Jasy 0.7.x task declaration
        elif type(func) is str:
            return task(**kwargs)

        else:
            raise UserError("Invalid task")
    
    else:

        def wrapper(func):
            return Task(func, **kwargs)
            
        return wrapper



# Local task managment
Specifies that this function is a task.
dataset/ETHPy150Open zynga/jasy/jasy/env/Task.py/task