code: def fedit(
      data, title="", comment="", icon=None, parent=None, apply=None
  ):
      """
      Create form dialog and return result
      (if Cancel button is pressed, return None)
  
      data: datalist, datagroup
      title: string
      comment: string
      icon: QIcon instance
      parent: parent QWidget
      apply: apply callback (function)
  
      datalist: list/tuple of (field_name, field_value)
      datagroup: list/tuple of (datalist *or* datagroup, title, comment)
  
      -> one field for each member of a datalist
      -> one tab for each member of a top-level datagroup
      -> one page (of a multipage widget, each page can be selected with a combo
         box) for each member of a datagroup inside a datagroup
  
      Supported types for field_value:
        - int, float, str, unicode, bool
        - colors: in Qt-compatible text form, i.e. in hex format or name (red,...)
                  (automatically detected from a string)
        - list/tuple:
            * the first element will be the selected index (or value)
            * the other elements can be couples (key, value) or only values
      """
  
      # Create a QApplication instance if no instance currently exists
      # (e.g., if the module is used directly from the interpreter)
      if QtWidgets.QApplication.startingUp():
          _app = QtWidgets.QApplication([])
      dialog = FormDialog(data, title, comment, icon, parent, apply)
      if dialog.exec_():
          return dialog.get()
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import copy
  import datetime
  import warnings
  import six
  from matplotlib import colors
  from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
label_desc: Use image node_id 6 for calling a global function with example usage: fedit(data, title, comment, icon, parent, apply) and returns: dialog