def sort_tasks(tasks, sort_by):
    assert sort_keys in sort_by.lstrip('-')
    reverse = False
    if sort_by.startswith('-'):
        sort_by = sort_by.lstrip('-')
        reverse = True
    for task in sorted(
            tasks,
            key=lambda x: getattr(x[1], sort_by) or sort_keys[sort_by](),
            reverse=reverse):
        yield task
dataset/ETHPy150Open mher/flower/flower/utils/tasks.py/sort_tasks/swapped operands of `in`