'Create a new task on the XQueue.
Arguments:
contents (dict): The contents of the XQueue task.
key (str): An access key for the task.  This will be sent
to the callback end-point once the task completes,
so that we can validate that the sender is the same
entity that received the task.
Keyword Arguments:
callback_url_path (str): The path of the callback URL.
If not provided, use the default end-point for student-generated
certificates.'

def _send_to_xqueue(self, contents, key, task_identifier=None, callback_url_path='/update_certificate'):

    callback_url = u'{protocol}://{base_url}{path}'.format(protocol=('https' if self.use_https else 'http'), base_url=settings.SITE_NAME, path=callback_url_path)
    callback_url += '?key={key}'.format(key=(task_identifier if (task_identifier is not None) else key))
    xheader = make_xheader(callback_url, key, settings.CERT_QUEUE)
    (error, msg) = self.xqueue_interface.send_to_queue(header=xheader, body=json.dumps(contents))
    if error:
        exc = XQueueAddToQueueError(error, msg)
        LOGGER.critical(unicode(exc))
        raise exc
