code: def generate_flags():
      all_nicknames = []
  
      def add_nickname(gtype, a, b):
          nickname = type_name(gtype)
          all_nicknames.append(nickname)
  
          type_map(gtype, add_nickname)
  
          return ffi.NULL
  
      type_map(type_from_name("GFlags"), add_nickname)
  
      # Filter internal flags
      filter = ["VipsForeignFlags"]
      all_nicknames = [
          name for name in all_nicknames if name not in filter
      ]
  
      for name in all_nicknames:
          gtype = type_from_name(name)
          python_name = remove_prefix(name)
          if python_name not in xml_flags:
              continue
  
          node = xml_flags[python_name]
          values = values_for_flag(gtype)
          enum_doc = node.find("goi:doc", namespace)
  
          print("")
          print("")
          print(f"class {python_name}(object):")
          print(f'    """{python_name}.')
          if enum_doc is not None:
              print("")
              print(f"{enum_doc.text}")
          print("")
          print("Attributes:")
          print("")
          for value in values:
              python_name = value.replace("-", "_")
              member = node.find(
                  f"goi:member[@name='{python_name}']", namespace
              )
              member_doc = member.find("goi:doc", namespace)
              if member_doc is not None:
                  text = member_doc.text
                  print(f"    {python_name.upper()} (int): {text}")
                  print("")
          print('    """')
          print("")
  
          for value in values:
              python_name = value.replace("-", "_")
              member = node.find(
                  f"goi:member[@name='{python_name}']", namespace
              )
              print(
                  f'    {python_name.upper()} = {member.get("value")}'
              )
  
imports: import sys
  import xml.etree.ElementTree
  from pyvips import ffi, values_for_enum, values_for_flag, vips_lib, type_map, type_name, type_from_name
label_desc: Use image node_id 3 for calling a global function with example usage: generate_flags() and returns: ffi