def create_ctype(self): self.ctype = type(self.name.encode('utf-8'), (ctypes.Union,), dict( _fields_ = [ (name, get_ctype(value)) for name, value in self.fields]))