def json_to_csv_subscriber(event):
    """
    Subscribes to all requests and if the accept header mentions csv
    it overrides the default renderer with the csv one
    """
    request = event.request
    try:
        if (request.accept.header_value.endswith('csv') and
                request.path.startswith('/api/')):
            request.override_renderer = 'csv'
            return True
    except AttributeError:
        pass