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

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

def accept(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 defined accepted content type,
       should pass in a dict with the following format:

            {'[content-type]': action,
             ...
            }
    """
    def output_type(data, request, response):
        accept = request.accept
        if accept in ('', '*', '/'):
            handler = default or handlers and next(iter(handlers.values()))
        else:
            handler = default
            accepted = [accept_quality(accept_type) for accept_type in accept.split(',')]
            accepted.sort(key=itemgetter(0))
            for quality, accepted_content_type in reversed(accepted):
                if accepted_content_type in handlers:
                    handler = handlers[accepted_content_type]
                    break

        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