docs: def write(self, values):
          """Write records to the vdata. Writing starts at the current
          record position, which is advanced by the number of records
          written.
  
          Args::
  
            values: 2-level sequence. First level is a sequence of records.
                    A second level gives the sequence of record values.
                    It is mandatory to always write whole records. Thus
                    every record field must appear at the second level.
                    The record values are ordered according the list of
                    field names set in the last call to the setfields()
                    method. The ordre of the complete vdata field set is
                    used if setfields() has not been called.
  
  
          Returns::
  
            number of records written
  
          To append to a vdata already holding 'n' records, it is necessary
          to first move the current record position to 'n-1' with a call to
          method seek(), then to call method read() for the side effect
          of advancing the current record position past this last record.
          Method seekend() does just that.
  
          C library equivalent : VSwrite
                                                         """
  
          nFields = self._nfields
          # Fields give the order the record values, as defined in the
          # last call to setfields()
          fields = self._setfields or self._fields
          # We must pack values using the effective field order in the vdata
          fieldList = ','.join(self._fields)
  
          # Validate the values argument.
          if nFields != len(fields):
              raise HDF4Error("write: must write whole records")
          if type(values) not in [list, tuple]:
              raise HDF4Error("write: values must be a sequence")
          nRec = len(values)
          for n in range(nRec):
              rec = values[n]
              if type(rec) not in [list, tuple]:
                  raise HDF4Error("write: records must be given as sequences")
              # Make sure each record is complete.
              if len(rec) != nFields:
                  raise HDF4Error("write: records must specify every field")
  
          # Allocate a buffer to store the packed records.
          bufSize = self._recsize * nRec
          bigBuf = _C.array_byte(bufSize)
  
          # Allocate an array to store a pointer to the field buffer.
          fldArr = _C.new_array_voidp(1)
  
          # Pack each field in turn.
          for numFld in range(nFields):
              fld = self.field(fields[numFld])
              data_type = fld._type
              order = fld._order
              n_values = order * nRec
  
              # Allocate a buffer to store the field values.
              if data_type in [HC.CHAR8, HC.UCHAR8, HC.UINT8]:
                  buf = _C.array_byte(n_values)
  
              elif data_type == HC.INT8:
                  buf = _C.array_int8(n_values)
  
              elif data_type == HC.INT16:
                  buf = _C.array_int16(n_values)
  
              elif data_type == HC.UINT16:
                  buf = _C.array_uint16(n_values)
  
              elif data_type == HC.INT32:
                  buf = _C.array_int32(n_values)
  
              elif data_type == HC.UINT32:
                  buf = _C.array_uint32(n_values)
  
              elif data_type == HC.FLOAT32:
                  buf = _C.array_float32(n_values)
  
              elif data_type == HC.FLOAT64:
                  buf = _C.array_float64(n_values)
  
              else:
                  raise HDF4Error("write: illegal or unupported type %d" % \
                                   data_type)
  
              # Load the field buffer with values.
              k = 0
              for numRec in range(nRec):
                  val = values[numRec][numFld]
                  # Single-valued field
                  if order == 1:
                      buf[k] = val
                      k += 1
                  # Multi-valued field
                  else:
                      # Handle strings specially.
                      if data_type == HC.CHAR8:
                          if not isinstance(val, str):
                              raise HDF4Error("char fields must be set with strings")
                          n = len(val)
                          for i in range(order):
                              buf[k] = i < n and ord(val[i]) or 0
                              k += 1
                      # Should validate field elements ...
                      elif type(val) not in [list, tuple]:
                          raise HDF4Error("multi-values fields must be given as sequences")
                      else:
                          for i in range(order):
                              buf[k] = val[i]
                              k += 1
  
              # Store address of the field buffer in first position
              # of the field array. Pack the field values.
              _C.array_voidp_setitem(fldArr, 0, buf) # fldArr[0] = buf
              _checkErr('write',
                        _C.VSfpack(self._id, 0, fieldList, bigBuf, bufSize,
                                   nRec, fld._name, fldArr),
                        "cannot execute")
              del buf
  
          # Write the packed records.
          n = _C.VSwrite(self._id, bigBuf, nRec, 0)   # 0: FULL_INTERLACE
          _checkErr('write', n, 'cannot execute')
          self._offset += nRec
  
          return n