def validate_items(self, item_list, item_type):
        """
        Go through a list Pmag_objects and check for:
        parent errors,
        children errors,
        type errors.
        Return a dictionary of exceptions in this format:
        {sample1: {'parent': [warning1, warning2, warning3], 'child': [warning1, warning2]},
         sample2: {'child': [warning1], 'type': [warning1, warning2]},
          ...}

        """
        def append_or_create_dict_item(warning_type, dictionary, key, value):
            """
            Add to dictionary with this format:
            {key1: {warning_type1: [value1, value2], warning_type2: [value1]},
            ...}
            """
            if not value:
                return
            try:
                name = key.name
            except AttributeError:
                name = key
            if not name in dictionary:
                dictionary[name] = {}
            if not warning_type in dictionary[name]:
                dictionary[name][warning_type] = []
            for v in value:
                dictionary[name][warning_type].append(v)

        def check_item_type(item, item_type):#, warnings=None):
            """
            Make sure that item has appropriate type, and is in the data object.
            """
            warnings = []
            item_list, item_class, item_constructor = self.data_lists[item_type]
            if not isinstance(item, item_class):
                warnings.append(PmagException('wrong type'))
            if item not in item_list:
                warnings.append(PmagException('not in data object'))
            return warnings

        def check_item_for_parent(item, item_type, parent_type):
            """
            Make sure that item has a parent of the correct type
            """
            if not parent_type:
                return []
            if not isinstance(item, Pmag_object):
                return []
            warnings = []
            parent = item.get_parent()
            parent_list, parent_class, parent_constructor = self.data_lists[parent_type]
            if not parent or not parent.name:
                warnings.append(PmagException('missing parent'))
                return warnings
            if not isinstance(parent, parent_class):
                warnings.append(PmagException('invalid parent type', parent))
            if not parent in parent_list:
                warnings.append(PmagException('parent not in data object', parent))
            return warnings

        def check_item_for_children(item, child_type):
            """
            Make sure that any children are of the correct type,
            and are in the data object
            """
            if not child_type:
                return []
            warnings = []
            children = item.children
            child_list, child_class, child_constructor = self.data_lists[child_type]
            for child in children:
                if not isinstance(child, child_class):
                    warnings.append(PmagException('child has wrong type', child))
                if not child in child_list:
                    warnings.append(PmagException('child not in data object', child))
            return warnings

        warnings = {}
        type_ind = self.ancestry.index(item_type)
        parent_type = self.ancestry[type_ind+1]
        child_type = self.ancestry[type_ind-1]
        for item in item_list:
            #warnings[item] = []
            type_warnings = check_item_type(item, item_type)
            append_or_create_dict_item('type', warnings, item, type_warnings)
            parent_warnings = check_item_for_parent(item, item_type, parent_type)
            append_or_create_dict_item('parent', warnings, item, parent_warnings)
            child_warnings = check_item_for_children(item, child_type)
            append_or_create_dict_item('children', warnings, item, child_warnings)
        return warnings