update task.py

added the sort method