def __init__(self, fileobj,<EOL>productversion=None, channel=None,<EOL>signing_key=None,<EOL>signing_algorithm=None,<EOL>):
self.fileobj = fileobj<EOL>if signing_algorithm and (fileobj.mode not in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')):<EOL><INDENT>raise ValueError('<STR_LIT>'.format(fileobj.mode))<EOL><DEDENT>self.data_fileobj = fileobj<EOL>self.entries = []<EOL>self.signature_offset = <NUM_LIT:8><EOL>self.additional_offset = None<EOL>self.last_offset = <NUM_LIT:8><EOL>self.filesize = <NUM_LIT:0><EOL>if (productversion or channel) and not (productversion and channel):<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>self.productversion = productversion<EOL>self.channel = channel<EOL>self.signing_key = signing_key<EOL>if signing_algorithm not in (None, '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>raise ValueError('<STR_LIT>'.format(signing_algorithm))<EOL><DEDENT>self.signing_algorithm = signing_algorithm<EOL>if productversion and channel:<EOL><INDENT>self.use_old_format = False<EOL><DEDENT>else:<EOL><INDENT>self.use_old_format = True<EOL><DEDENT>if self.use_old_format and self.signing_key:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>self.write_header()<EOL>if not self.use_old_format:<EOL><INDENT>fake_sigs = self.dummy_signatures()<EOL>self.write_signatures(fake_sigs)<EOL>self.write_additional(productversion, channel)<EOL><DEDENT>
Initialize a new MarWriter object.

        Note:
            Files should always be opened in binary mode.

        Args:
            fileobj (file object): A file-like object open in read/write mode
                (e.g. 'w+b' mode) where the MAR data will be written to. This
                object must also be seekable (i.e.  support .seek() and
                .tell()).
            productversion (str): product version string to encode in the MAR
                header
            channel (str): channel name to encode in the MAR header
                productversion and channel must be specified together
            signing_key (str): PEM encoded private key used for signing
            signing_algorithm (str): one of None, 'sha1', 'sha384'