Returns a content in a different format based on the clients provided content type,
       should pass in a dict with the following format:

            {'[content-type]': action,
             ...
            }

def on_content_type(handlers, default=None, error='The requested content type does not match any of those allowed'):
    """Returns a content in a different format based on the clients provided content type,
       should pass in a dict with the following format:

            {'[content-type]': action,
             ...
            }
    """
    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__ or function.__name__ for function in handlers.values()))
    output_type.content_type = ', '.join(handlers.keys())
    return output_type