code: def write_bytes(fp, data):
      
      pos = fp.tell()
      fp.write(data)
      written = fp.tell() - pos
      assert written == len(data), 'written=%d, expected=%d' % (
          written, len(data)
      )
      return written
docs: Write bytes to the file object and returns bytes written.
  
      :return: written byte size