def suffix(transformers, default=None):
 transformers = {suffix: (auto_kwargs(transformer) if transformer else transformer) for (suffix, transformer) in transformers.items()}
 default = (default and auto_kwargs(default))
 def transform(data, request):
  path = request.path
  transformer = default
  for (suffix_test, suffix_transformer) in transformers.items():
   if path.endswith(suffix_test):
    transformer = suffix_transformer
    break
  return (transformer(data) if transformer else data)
 return transform

def suffix ( transformers , default = None ) : transformers = { suffix : ( auto_kwargs ( transformer ) if transformer else transformer ) for ( suffix , transformer ) in transformers . items ( ) } default = ( default and auto_kwargs ( default ) ) def transform ( data , request ) : path = request . path transformer = default for ( suffix_test , suffix_transformer ) in transformers . items ( ) : if path . endswith ( suffix_test ) : transformer = suffix_transformer break return ( transformer ( data ) if transformer else data ) return transform
returns a content in a different format based on the suffix placed at the end of the url route should pass in a dict with the following format: {[suffix]: action .