def _compare_tasks(self, reference, result):
        """Compare deployment tasks.

        Considering legacy format and compatible validator output with extra
        fields where legacy fields is converted to new syntax.

        :param reference: list of tasks
        :type reference: list
        :param result: list of tasks
        :type result: list
        """
        reference.sort(key=lambda x: x.get('id', x.get('task_name')))
        result.sort(key=lambda x: x.get('id', x.get('task_name')))
        self.assertEqual(len(reference), len(result))
        for ref, res in six.moves.zip(reference, result):
            for field in ref:
                if field == '_custom':
                    # unpack custom json fields if persist
                    self.assertEqual(
                        jsonutils.loads(ref.get(field)),
                        jsonutils.loads((res or {}).get(field))
                    )
                else:
                    self.assertEqual(ref.get(field), (res or {}).get(field))


# this method is for development and troubleshooting purposes
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/base.py/DeploymentTasksTestMixin._compare_tasks/original