def on_content_type(handlers, default=None, error='The requested content type does not match any of those allowed'):
 def output_type(data, request, response):
  handler = handlers.get(request.content_type.split(';')[0], default)
  if (not handler):
   raise falcon.HTTPNotAcceptable(error)
  response.content_type = handler.content_type
  return handler(data, request=request, response=response)
 output_type.__doc__ = 'Supports any of the following formats: {0}'.format(', '.join((function.__doc__ for function in handlers.values())))
 output_type.content_type = ', '.join(handlers.keys())
 return output_type

def on_content_type ( handlers , default = None , error = 'The requested content type does not match any of those allowed' ) : def output_type ( data , request , response ) : handler = handlers . get ( request . content_type . split ( ';' ) [ 0 ] , default ) if ( not handler ) : raise falcon . HTTPNotAcceptable ( error ) response . content_type = handler . content_type return handler ( data , request = request , response = response ) output_type . __doc__ = 'Supports any of the following formats: {0}' . format ( ', ' . join ( ( function . __doc__ for function in handlers . values ( ) ) ) ) output_type . content_type = ', ' . join ( handlers . keys ( ) ) return output_type
returns a content in a different format based on the clients provided content type .