The ascii representation of the detector

def ascii(self):
        """The ascii representation of the detector"""
        comments = ''
        if self.version == 'v3':
            for comment in self.comments:
                if not comment.startswith(' '):
                    comment = ' ' + comment
                comments += "#" + comment + "\n"

        if self.version == 'v1':
            header = "{det.det_id} {det.n_doms}".format(det=self)
        else:
            header = "{det.det_id} {det.version}".format(det=self)
            header += "\n{0} {1}".format(self.valid_from, self.valid_until)
            header += "\n" + str(self.utm_info) + "\n"
            header += str(self.n_doms)

        doms = ""
        for dom_id, (line, floor, n_pmts) in self.doms.items():
            doms += "{0} {1} {2} {3}\n".format(dom_id, line, floor, n_pmts)
            for channel_id in range(n_pmts):
                pmt_idx = self._pmt_index_by_omkey[(line, floor, channel_id)]
                pmt = self.pmts[pmt_idx]
                doms += " {0} {1} {2} {3} {4} {5} {6} {7}".format(
                    pmt.pmt_id, pmt.pos_x, pmt.pos_y, pmt.pos_z, pmt.dir_x,
                    pmt.dir_y, pmt.dir_z, pmt.t0
                )
                if self.version == 'v3':
                    doms += " {0}".format(pmt.status)
                doms += "\n"
        return comments + header + "\n" + doms