code: def print_struct(struct, ident=0):
      
      if not isinstance(struct, (str, bytes, list, tuple)) and hasattr(struct, '__getitem__'): # array
          print('[')
          for item in struct:
              print(" "*ident, end=' ')
              print_struct(item, ident+1)
          print(" "*ident + "]")
      elif not hasattr(struct, '_fields_'):
          print(struct)
      else:
          if ident:
              print()
  
          for name, _ in struct._fields_:
              print(" "*ident + "{}:".format(name), end=' ')
              print_struct(getattr(struct, name), ident+1)
docs: >>> from ctypes import *
      >>> class Test(Structure):
      ...     _fields_ = [('foo', c_int)]
      ... 
      >>> class Test2(Structure):
      ...     _fields_ = [('foo', Test), ('bar', c_int)]
      ... 
      >>> t = Test2()
      >>> t.foo.foo = 2
      >>> t.bar = 1
      >>> print_struct(t)
      foo: 
       foo: 2
      bar: 1