'Update the status of the example certificate.
This will usually be called either:
1) When an error occurs adding the certificate to the queue.
2) When we receieve a response from the queue (either error or success).
If an error occurs, we store the error message;
if certificate generation is successful, we store the URL
for the generated certificate.
Arguments:
status (str): Either `STATUS_SUCCESS` or `STATUS_ERROR`
Keyword Arguments:
error_reason (unicode): A description of the error that occurred.
download_url (unicode): The URL for the generated certificate.
Raises:
ValueError: The status is not a valid value.'

def update_status(self, status, error_reason=None, download_url=None):

    if (status not in [self.STATUS_SUCCESS, self.STATUS_ERROR]):
        msg = u"Invalid    status:    must    be    either    '{success}'    or    '{error}'.".format(success=self.STATUS_SUCCESS, error=self.STATUS_ERROR)
        raise ValueError(msg)
    self.status = status
    if ((status == self.STATUS_ERROR) and error_reason):
        self.error_reason = error_reason
    if ((status == self.STATUS_SUCCESS) and download_url):
        self.download_url = download_url
    self.save()
