def get_task_from_tree_view(self, tree_view):
        task = None
        selection_model = tree_view.selectionModel()

        indexes = selection_model.selectedIndexes()

        if indexes:
            current_index = indexes[0]

            item_model = tree_view.model()
            current_item = item_model.itemFromIndex(current_index)

            if current_item:
                try:
                    task = current_item.task
                except AttributeError:
                    pass

        return task
Data with validation errors raises a bad request exception
dataset/ETHPy150Open eoyilmaz/anima/anima/ui/version_mover.py/VersionMover.get_task_from_tree_view--crossover with--dataset/ETHPy150Open freakboy3742/pyxero/tests/exceptions.py/ExceptionsTest.test_bad_request