<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _enqueue_capture(build, release, run, url, config_data, baseline=False):
 """Enqueues a task to run a capture process."""

    # Validate the JSON config parses.
    try:
        config_dict = json.loads(config_data)
    except Exception, e:
        abort(utils.jsonify_error(e))

    # Rewrite the config JSON to include the URL specified in this request.
    # Blindly overwrite anything that was there.
    config_dict['targetUrl'] = url
    config_data = json.dumps(config_dict)

    config_artifact = _save_artifact(build, config_data, 'application/json')
    db.session.add(config_artifact)
    db.session.flush()

    suffix = ''
    if baseline:
        suffix = ':baseline'

    task_id = '%s:%s%s' % (run.id, hashlib.sha1(url).hexdigest(), suffix)
    logging.info('Enqueueing capture task=%r, baseline=%r', task_id, baseline)

    work_queue.add(
        constants.CAPTURE_QUEUE_NAME,
        payload=dict(
            build_id=build.id,
            release_name=release.name,
            release_number=release.number,
            run_name=run.name,
            url=url,
            config_sha1sum=config_artifact.id,
            baseline=baseline,
        ),
        build_id=build.id,
        release_id=release.id,
        run_id=run.id,
        source='request_run',
        task_id=task_id)

    # Set the URL and config early to indicate to report_run that there is
    # still data pending even if 'image' and 'ref_image' are unset.
    if baseline:
        run.ref_url = url
        run.ref_config = config_artifact.id
    else:
        run.url = url
        run.config = config_artifact.id