generic 'make this function into a filter' decorator