'Gets source and duplicated items from the modulestore using supplied usage keys.
Then verifies that they represent equivalent items (modulo parents and other
known things that may differ).'

def _check_equality(self, source_usage_key, duplicate_usage_key, parent_usage_key=None, check_asides=False, is_child=False):

    original_item = self.get_item_from_modulestore(source_usage_key)
    duplicated_item = self.get_item_from_modulestore(duplicate_usage_key)
    if check_asides:
        original_asides = original_item.runtime.get_asides(original_item)
        duplicated_asides = duplicated_item.runtime.get_asides(duplicated_item)
        self.assertEqual(len(original_asides), 1)
        self.assertEqual(len(duplicated_asides), 1)
        self.assertEqual(original_asides[0].field11, duplicated_asides[0].field11)
        self.assertEqual(original_asides[0].field12, duplicated_asides[0].field12)
        self.assertNotEqual(original_asides[0].field13, duplicated_asides[0].field13)
        self.assertEqual(duplicated_asides[0].field13, 'aside1_default_value3')
    self.assertNotEqual(unicode(original_item.location), unicode(duplicated_item.location), 'Location    of    duplicate    should    be    different    from    original')
    if (parent_usage_key and (unicode(original_item.parent) == unicode(parent_usage_key))):
        self.assertEqual(unicode(parent_usage_key), unicode(duplicated_item.parent), 'Parent    of    duplicate    should    equal    parent    of    source    for    root    xblock    when    duplicated    in-place')
    else:
        self.assertNotEqual(unicode(original_item.parent), unicode(duplicated_item.parent), 'Parent    duplicate    should    be    different    from    source')
    duplicated_item.location = original_item.location
    duplicated_item.parent = original_item.parent
    if original_item.has_children:
        self.assertEqual(len(original_item.children), len(duplicated_item.children), 'Duplicated    item    differs    in    number    of    children')
        for i in xrange(len(original_item.children)):
            if (not self._check_equality(original_item.children[i], duplicated_item.children[i], is_child=True)):
                return False
        duplicated_item.children = original_item.children
    return self._verify_duplicate_display_name(original_item, duplicated_item, is_child)
