code: def format_stackdriver_json(record, message):
      
      subsecond, second = math.modf(record.created)
  
      payload = {
          "message": message,
          "timestamp": {"seconds": int(second), "nanos": int(subsecond * 1e9)},
          "thread": record.thread,
          "severity": record.levelname,
      }
  
      return json.dumps(payload)
docs: Helper to format a LogRecord in in Stackdriver fluentd format.
  
          :rtype: str
          :returns: JSON str to be written to the log file.