i think you can simplify by defining safedelete that accepts f args and kwargs and calls it while catching notfound  then in  create resource you call self addcleanup self safedelete  data  id  and in create bandwidth limit rule you call it with the additional policy id  the advantage is that you do not have to define the wrapper in line the disadvantage is that any new create method will have to know to use self addcleanup with self safedelete and that it will not be automatic like you did here with overriding addcleanup  i am not in love with the idea of overriding addcleanup and i think that any new create method people will just copy paste something else in this file anyway so overall i like my suggestion better 