Create a suitable response

    Args:
        rv: return value of action
        code: status code
        headers: response headers
    Returns:
        flask.Response

def export(rv, code=None, headers=None):
    """
    Create a suitable response

    Args:
        rv: return value of action
        code: status code
        headers: response headers
    Returns:
        flask.Response
    """
    if isinstance(rv, ResponseBase):
        return make_response(rv, code, headers)
    else:
        if code is None:
            code = 200
        mediatype = request.accept_mimetypes.best_match(
            exporters.keys(), default='application/json')
        return exporters[mediatype](rv, code, headers)