code: def write(self, data, debug_info=None):
          
          self.num_write_bytes += len(data)
          if self.debug:
              if not debug_info:
                  debug_info = str(len(data))
              sys.stderr.write("%s: WRITE %s:\n%s\n" % (
                  self.__class__.__name__,
                  debug_info,
                  pyhsm.util.hexdump(data)
              ))
          write_sock(self.socket_file, CMD_WRITE, data)
          return read_sock(self.socket_file)
docs: Write data to YHSM device.