def prefix(transformers, default=None):
 transformers = {prefix: (auto_kwargs(transformer) if transformer else transformer) for (prefix, transformer) in transformers.items()}
 default = (default and auto_kwargs(default))
 def transform(data, request=None, response=None):
  path = request.path
  transformer = default
  for (prefix_test, prefix_transformer) in transformers.items():
   if path.startswith(prefix_test):
    transformer = prefix_transformer
    break
  return (transformer(data) if transformer else data)
 return transform

def prefix ( transformers , default = None ) : transformers = { prefix : ( auto_kwargs ( transformer ) if transformer else transformer ) for ( prefix , transformer ) in transformers . items ( ) } default = ( default and auto_kwargs ( default ) ) def transform ( data , request = None , response = None ) : path = request . path transformer = default for ( prefix_test , prefix_transformer ) in transformers . items ( ) : if path . startswith ( prefix_test ) : transformer = prefix_transformer break return ( transformer ( data ) if transformer else data ) return transform
creates a prefix operator .