<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _write_header(self):
 """Builds the message header and writes it to the output stream."""

        self.output_buffer += serialize_header(header=self._header, signer=self.signer)
        self.output_buffer += serialize_header_auth(
            algorithm=self._encryption_materials.algorithm,
            header=self.output_buffer,
            data_encryption_key=self._derived_data_key,
            signer=self.signer,
        )