def write_to_file(self, filename, do_compress=None):
is_ext_laz = filename.split("<STR_LIT:.>")[-<NUM_LIT:1>] == "<STR_LIT>"<EOL>if is_ext_laz and do_compress is None:<EOL><INDENT>do_compress = True<EOL><DEDENT>with open(filename, mode="<STR_LIT:wb>") as out:<EOL><INDENT>self.write_to(out, do_compress=do_compress)<EOL><DEDENT>
Writes the las data into a file

        Parameters
        ----------
        filename : str
            The file where the data should be written.
        do_compress: bool, optional, default None
            if None the extension of the filename will be used
            to determine if the data should be compressed
            otherwise the do_compress flag indicate if the data should be compressed