<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_status(self, message=None, console_url=None, status_links=None):
 """Sets the current status of this pipeline. This method is purposefully non-transactional. Updates are written to the datastore immediately and overwrite all existing statuses. Args: message: (optional) Overall status message. console_url: (optional) Relative URL to use for the "console" of this pipeline that displays current progress. When None, no console will be displayed. status_links: (optional) Dictionary of readable link names to relative URLs that should be associated with this pipeline as it runs. These links provide convenient access to other dashboards, consoles, etc associated with the pipeline. Raises: PipelineRuntimeError if the status could not be set for any reason. """

    if _TEST_MODE:
      logging.info(
          'New status for %s#%s: message=%r, console_url=%r, status_links=%r',
          self, self.pipeline_id, message, console_url, status_links)
      return

    status_key = db.Key.from_path(_StatusRecord.kind(), self.pipeline_id)
    root_pipeline_key = db.Key.from_path(
        _PipelineRecord.kind(), self.root_pipeline_id)
    status_record = _StatusRecord(
        key=status_key, root_pipeline=root_pipeline_key)

    try:
      if message:
        status_record.message = message
      if console_url:
        status_record.console_url = console_url
      if status_links:
        # Alphabeticalize the list.
        status_record.link_names = sorted(
            db.Text(s) for s in status_links.iterkeys())
        status_record.link_urls = [
            db.Text(status_links[name]) for name in status_record.link_names]

      status_record.status_time = datetime.datetime.utcnow()

      status_record.put()
    except Exception, e:
      raise PipelineRuntimeError('Could not set status for %s#%s: %s' %
          (self, self.pipeline_id, str(e)))