code: def prt_tsv_dat(prt, data_nts, **kws):
      
      sep = "\t" if 'sep' not in kws else kws['sep']
      fld2fmt = None if 'fld2fmt' not in kws else kws['fld2fmt']
      if 'sort_by' in kws:
          data_nts = sorted(data_nts, key=kws['sort_by'])
      prt_if = kws['prt_if'] if 'prt_if' in kws else None
      prt_flds = kws['prt_flds'] if 'prt_flds' in kws else data_nts[0]._fields
      items = 0
      for nt_data_row in data_nts:
          if prt_if is None or prt_if(nt_data_row):
              if fld2fmt is not None:
                  row_fld_vals = [(fld, getattr(nt_data_row, fld)) for fld in prt_flds]
                  row_vals = _fmt_fields(row_fld_vals, fld2fmt)
              else:
                  row_vals = [getattr(nt_data_row, fld) for fld in prt_flds]
              prt.write("{}\n".format(sep.join(str(d) for d in row_vals)))
              items += 1
      return items
docs: Print tab-separated table data