code: def qteIsMacroRegistered(self, macroName: str,
                               widgetObj: QtGui.QWidget=None):
          
          if widgetObj is None:
              # Ignore the applet- and widget signature and simply check
              # if a macro with the desired name exists.
              macroList = [_ for _ in self._qteRegistryMacros
                           if _[0] == macroName]
              if len(macroList) > 0:
                  return True
              else:
                  return False
          else:
              # Take the applet- and widget signature into account.
              macroObj = self.qteGetMacroObject(macroName, widgetObj)
              if macroObj is None:
                  return False
              else:
                  return True
docs: Return **True** if a macro with name ``macroName`` exists.
  
          If ``widgetObj`` is **None** then only the macro name is
          matched. Otherwise, only macros that are compatible with
          ``widgetObj`` are returned.
  
  
          |Args|
  
          * ``macroName`` (**str**): name of macro.
          * ``widgetObj`` (**QWidget**): widget with which the macro
            must be compatible.
  
          |Returns|
  
          * **bool**: whether or not a compatible macro exists.
  
          |Raises|
  
          * **QtmacsArgumentError** if at least one argument has an invalid type.