def METHOD_NAME(session):
    """
    Mark an object's related object as dirty when certain attributes of the
    object (its `propagated_attributes`) change.
    For example, when a message's `is_read`, `is_starred` or `categories`
    changes, the message.thread is marked as dirty.
    """
    from inbox.models.message import Message
    for obj in session.dirty:
        if isinstance(obj, Message):
            obj_state = inspect(obj)
            for attr in obj.propagated_attributes:
                if getattr(obj_state.attrs, attr).history.has_changes() and obj.thread:
                    obj.thread.dirty = True