'Mark the method as replacing an entity in the collection.
Adds "add to collection" and "remove from collection" handling to
the method.  The decorator argument indicates which method argument
holds the SQLAlchemy-relevant value to be added, and return value, if
any will be considered the value to remove.
Arguments can be specified positionally (i.e. integer) or by name::
@collection.replaces(2)
def __setitem__(self, index, item): ...'

@staticmethod
def replaces(arg):

    def decorator(fn):
        fn._sa_instrument_before = ('fire_append_event', arg)
        fn._sa_instrument_after = 'fire_remove_event'
        return fn
    return decorator
