'Get the first component item with these flags
@param flags: dictionary of flags'

def get_last(self, **flags):

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