Get the raw data that the job returned. The mimetype
    will be the value provided in the metdata for the key ``mimetype``.

    **Results:**

    :rtype: string

    :statuscode 200: no error
    :statuscode 403: not authorized to view the job's data
    :statuscode 404: job id not found
    :statuscode 409: an error occurred

def job_data(job_id):
    '''Get the raw data that the job returned. The mimetype
    will be the value provided in the metdata for the key ``mimetype``.

    **Results:**

    :rtype: string

    :statuscode 200: no error
    :statuscode 403: not authorized to view the job's data
    :statuscode 404: job id not found
    :statuscode 409: an error occurred
    '''
    job_dict = db.get_job(job_id)
    if not job_dict:
        return json.dumps({'error': 'job_id not found'}), 404, headers
    if not is_authorized(job_dict):
        return json.dumps({'error': 'not authorized'}), 403, headers
    if job_dict['error']:
        return json.dumps({'error': job_dict['error']}), 409, headers
    content_type = job_dict['metadata'].get('mimetype')
    return flask.Response(job_dict['data'], mimetype=content_type)