code: def test_qsort(self):
      comparefunc = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_char))
      lib.my_qsort.argtypes = c_void_p, c_size_t, c_size_t, comparefunc
      lib.my_qsort.restype = None
  
      def sort(a, b):
          return three_way_cmp(a[0], b[0])
  
      chars = create_string_buffer(b"spam, spam, and spam")
      lib.my_qsort(
          chars, len(chars) - 1, sizeof(c_char), comparefunc(sort)
      )
      self.assertEqual(chars.raw, b"   ,,aaaadmmmnpppsss\x00")
  
file_path: cpython/Lib/test/test_ctypes/test_libc.py
imports: import _ctypes_test
  import math
  import unittest
  from ctypes import CDLL, CFUNCTYPE, POINTER, create_string_buffer, sizeof, c_void_p, c_char, c_int, c_double, c_size_t
label_desc: Use image node_id 2 for calling the LibTest obj's underlying member method code with example usage: obj.test_qsort() and returns: three_way_cmp