human
I wrote the below code

    key = prop.key
    def append(state, item, initiator):
        if (item is None):
            return
        sess = state.session
        if sess:
            if sess._warn_on_events:
                sess._flush_warning('collection    append')
            prop = state.manager.mapper._props[key]
            item_state = attributes.instance_state(item)
            if (prop._cascade.save_update and (prop.cascade_backrefs or (key == initiator.key)) and (not sess._contains_state(item_state))):
                sess._save_or_update_state(item_state)
        return item
    def remove(state, item, initiator):
        if (item is None):
            return
        sess = state.session
        if sess:
            prop = state.manager.mapper._props[key]
            if sess._warn_on_events:
                sess._flush_warning(('collection    remove' if prop.uselist else 'related    attribute    delete'))
            item_state = attributes.instance_state(item)
            if (prop._cascade.delete_orphan and (item_state in sess._new) and prop.mapper._is_orphan(item_state)):
                sess.expunge(item)
    def set_(state, newvalue, oldvalue, initiator):
        if (oldvalue is newvalue):
            return newvalue
        sess = state.session
        if sess:
            if sess._warn_on_events:
                sess._flush_warning('related    attribute    set')
            prop = state.manager.mapper._props[key]
            if (newvalue is not None):
                newvalue_state = attributes.instance_state(newvalue)
                if (prop._cascade.save_update and (prop.cascade_backrefs or (key == initiator.key)) and (not sess._contains_state(newvalue_state))):
                    sess._save_or_update_state(newvalue_state)
            if ((oldvalue is not None) and (oldvalue is not attributes.PASSIVE_NO_RESULT) and prop._cascade.delete_orphan):
                oldvalue_state = attributes.instance_state(oldvalue)
                if ((oldvalue_state in sess._new) and prop.mapper._is_orphan(oldvalue_state)):
  ...

What's a good function header?
assistant
#Here's a good function header.

def track_cascade_events(descriptor, prop):