'Compare response from bulk.execute() to expected response.'

def assertEqualResponse(self, expected, actual):

    for (key, value) in expected.items():
        if (key == 'nModified'):
            if self.has_write_commands:
                self.assertEqual(value, actual['nModified'])
            else:
                self.assertFalse(('nModified' in actual))
        elif (key == 'upserted'):
            expected_upserts = value
            actual_upserts = actual['upserted']
            self.assertEqual(len(expected_upserts), len(actual_upserts), ('Expected    %d    elements    in    "upserted",    got    %d' % (len(expected_upserts), len(actual_upserts))))
            for (e, a) in zip(expected_upserts, actual_upserts):
                self.assertEqualUpsert(e, a)
        elif (key == 'writeErrors'):
            expected_errors = value
            actual_errors = actual['writeErrors']
            self.assertEqual(len(expected_errors), len(actual_errors), ('Expected    %d    elements    in    "writeErrors",    got    %d' % (len(expected_errors), len(actual_errors))))
            for (e, a) in zip(expected_errors, actual_errors):
                self.assertEqualWriteError(e, a)
        else:
            self.assertEqual(actual.get(key), value, ('%r    value    of    %r    does    not    match    expected    %r' % (key, actual.get(key), value)))
