code: def write_fmt(fp, fmt, *args):
      
      fmt = str(">" + fmt)
      fmt_size = struct.calcsize(fmt)
      written = write_bytes(fp, struct.pack(fmt, *args))
      assert written == fmt_size, 'written=%d, expected=%d' % (
          written, fmt_size
      )
      return written
docs: Writes data to ``fp`` according to ``fmt``.