Retrieve available statuses for a task

me=aq.get_current_user()
tasks=me.get_tasks()
statuses=tasks[0].get_statuses()

Advanced query

meshql = "# <($Child, 40)- path.vertices[*].type NONE == 'User' -($Child)> $Properties AND item.data.tasks_status != null VIEW item.data.tasks_status"
statuses = tasks[0].traverse(meshql=meshql)

Depending on the structure of your project, you might have multiple properties returning the available statuses.

You can also get the version statuses using the same query, but replacing tasks_status by versions_status.