code: def write(self, filename, format='tar'):
          
          if format == 'tar':
              Tribe(templates=[self]).write(filename=filename)
          else:
              self.st.write(filename, format=format)
          return self
docs: Write template.
  
          :type filename: str
          :param filename:
              Filename to write to, if it already exists it will be opened and
              appended to, otherwise it will be created.
          :type format: str
          :param format:
              Format to write to, either 'tar' (to retain metadata), or any obspy
              supported waveform format to just extract the waveform.
  
          .. rubric:: Example
  
          >>> template_a = Template(
          ...     name='a', st=read(), lowcut=2.0, highcut=8.0, samp_rate=100,
          ...     filt_order=4, process_length=3600, prepick=0.5)
          >>> template_a.write('test_template') # doctest: +NORMALIZE_WHITESPACE
          Template a:
           3 channels;
           lowcut: 2.0 Hz;
           highcut: 8.0 Hz;
           sampling rate 100 Hz;
           filter order: 4;
           process length: 3600 s
          >>> template_a.write('test_waveform.ms',
          ...                  format='MSEED') # doctest: +NORMALIZE_WHITESPACE
          Template a:
           3 channels;
           lowcut: 2.0 Hz;
           highcut: 8.0 Hz;
           sampling rate 100 Hz;
           filter order: 4;
           process length: 3600 s