docs: def WriteBuildYaml(self, fd, build_timestamp=True):
      """Write build spec to fd."""
      output = {
          "Client.build_environment":
              rdf_client.Uname.FromCurrentSystem().signature(),
          "Template.build_type":
              config.CONFIG.Get("ClientBuilder.build_type", context=self.context),
          "Template.version_major":
              config.CONFIG.Get("Source.version_major", context=self.context),
          "Template.version_minor":
              config.CONFIG.Get("Source.version_minor", context=self.context),
          "Template.version_revision":
              config.CONFIG.Get("Source.version_revision", context=self.context),
          "Template.version_release":
              config.CONFIG.Get("Source.version_release", context=self.context),
          "Template.arch":
              config.CONFIG.Get("Client.arch", context=self.context)
      }
  
      if build_timestamp:
        output["Client.build_time"] = rdfvalue.RDFDatetime.Now()
      else:
        self.REQUIRED_BUILD_YAML_KEYS.remove("Client.build_time")
  
      for key, value in iteritems(output):
        output[key] = str(value)
  
      output["Template.build_context"] = self.context
  
      output_keys = set(iterkeys(output))
      if output_keys != self.REQUIRED_BUILD_YAML_KEYS:
        raise RuntimeError("Bad build.yaml: expected %s, got %s" %
                           (self.REQUIRED_BUILD_YAML_KEYS, output_keys))
      fd.write(yaml.Dump(output).encode("utf-8"))