code: def wr_ann_file(self, write_fs, write_dir=''):
          
  
          # Calculate the fs bytes to write if present and desired to write
          if write_fs:
              fs_bytes = self.calc_fs_bytes()
          else:
              fs_bytes = []
          # Calculate the custom_labels bytes to write if present
          cl_bytes = self.calc_cl_bytes()
          # Calculate the core field bytes to write
          core_bytes = self.calc_core_bytes()
  
          # Mark the end of the special annotation types if needed
          if fs_bytes == [] and cl_bytes == []:
              end_special_bytes = []
          else:
              end_special_bytes = [0, 236, 255, 255, 255, 255, 1, 0]
  
          # Write the file
          with open(os.path.join(write_dir, self.record_name+'.'+self.extension),
                    'wb') as f:
              # Combine all bytes to write: fs (if any), custom annotations (if any), main content, file terminator
              np.concatenate((fs_bytes, cl_bytes, end_special_bytes, core_bytes,
                              np.array([0,0]))).astype('u1').tofile(f)
  
          return
docs: Calculate the bytes used to encode an annotation set and
          write them to an annotation file