code: def IOC(dir, type, nr, size):
      
      assert dir <= _IOC_DIRMASK, dir
      assert type <= _IOC_TYPEMASK, type
      assert nr <= _IOC_NRMASK, nr
      assert size <= _IOC_SIZEMASK, size
      return (dir << _IOC_DIRSHIFT) | (type << _IOC_TYPESHIFT) | (nr << _IOC_NRSHIFT) | (size << _IOC_SIZESHIFT)
docs: dir
          One of IOC_NONE, IOC_WRITE, IOC_READ, or IOC_READ|IOC_WRITE.
          Direction is from the application's point of view, not kernel's.
      size (14-bits unsigned integer)
          Size of the buffer passed to ioctl's "arg" argument.