code: def test_struct_by_value(self):
      class POINT(Structure):
          _fields_ = [("x", c_long), ("y", c_long)]
  
      class RECT(Structure):
          _fields_ = [
              ("left", c_long),
              ("top", c_long),
              ("right", c_long),
              ("bottom", c_long),
          ]
  
      dll = CDLL(_ctypes_test.__file__)
  
      pt = POINT(15, 25)
      left = c_long.in_dll(dll, "left")
      top = c_long.in_dll(dll, "top")
      right = c_long.in_dll(dll, "right")
      bottom = c_long.in_dll(dll, "bottom")
      rect = RECT(left, top, right, bottom)
      PointInRect = dll.PointInRect
      PointInRect.argtypes = [POINTER(RECT), POINT]
      self.assertEqual(1, PointInRect(byref(rect), pt))
  
      ReturnRect = dll.ReturnRect
      ReturnRect.argtypes = [
          c_int,
          RECT,
          POINTER(RECT),
          POINT,
          RECT,
          POINTER(RECT),
          POINT,
          RECT,
      ]
      ReturnRect.restype = RECT
      for i in range(4):
          ret = ReturnRect(
              i, rect, pointer(rect), pt, rect, byref(rect), pt, rect
          )
          # the c function will check and modify ret if something is
          # passed in improperly
          self.assertEqual(ret.left, left.value)
          self.assertEqual(ret.right, right.value)
          self.assertEqual(ret.top, top.value)
          self.assertEqual(ret.bottom, bottom.value)
  
      # to not leak references, we must clean _pointer_type_cache
      del _pointer_type_cache[RECT]
  
imports: import _ctypes_test
  import ctypes
  import errno
  import sys
  import unittest
  from ctypes import CDLL, Structure, POINTER, pointer, sizeof, byref, _pointer_type_cache, c_void_p, c_char, c_int, c_long
  from test import support
  from ._support import Py_TPFLAGS_DISALLOW_INSTANTIATION, Py_TPFLAGS_IMMUTABLETYPE
label_desc: Use image node_id 1 for calling the Structures obj's underlying member method code with example usage: obj.test_struct_by_value() without return types