'Get the previous item in the parent\'s component list with these
flags
@param flags: dictionary of flags'

def get_prev(self, **flags):

    preceding = self.preceding()
    preceding.reverse()
    for item in preceding:
        if ((not flags) or all([(getattr(item, f) == flags[f]) for f in flags])):
            return item
    return None
