code: def nn_getsockopt(socket, level, option, value):
      
      if memoryview(value).readonly:
          raise TypeError('Writable buffer is required')
      size_t_size = ctypes.c_size_t(len(value))
      rtn = _nn_getsockopt(socket, level, option, ctypes.addressof(value),
                           ctypes.byref(size_t_size))
      return (rtn, size_t_size.value)
docs: retrieve a socket option
  
      socket - socket number
      level - option level
      option - option
      value - a writable byte buffer (e.g. a bytearray) which the option value
      will be copied to
      returns - number of bytes copied or on error nunber < 0