code: def qteGetMacroObject(self, macroName: str, widgetObj: QtGui.QWidget):
          if hasattr(widgetObj, '_qteAdmin'):
              app_signature = widgetObj._qteAdmin.appletSignature
              wid_signature = widgetObj._qteAdmin.widgetSignature
              if app_signature is None:
                  msg = 'Applet has no signature.'
                  self.qteLogger.error(msg, stack_info=True)
                  return None
          else:
              wid_signature = None
              app = qteGetAppletFromWidget(widgetObj)
              if app is None:
                  app_signature = None
              else:
                  app_signature = app._qteAdmin.appletSignature
          name_match = [m for m in self._qteRegistryMacros if m[0] == macroName]
          app_sig_match = [_ for _ in name_match if _[1] in (app_signature, '*')]
          if wid_signature is None:
              wid_sig_match = [_ for _ in app_sig_match if _[2] == '*']
          else:
              wid_sig_match = [_ for _ in app_sig_match
                               if _[2] in (wid_signature, '*')]
          if len(wid_sig_match) == 0:
              return None
          elif len(wid_sig_match) == 1:
              match = wid_sig_match[0]
              return self._qteRegistryMacros[match]
          else:
              tmp = [match for match in wid_sig_match if (match[1] != '*')
                     and (match[2] != '*')]
              if len(tmp) > 0:
                  match = tmp[0]
                  return self._qteRegistryMacros[match]
              tmp = [match for match in wid_sig_match if match[2] != '*']
              if len(tmp) > 0:
                  match = tmp[0]
                  return self._qteRegistryMacros[match]
              tmp = [match for match in wid_sig_match if match[1] != '*']
              if len(tmp) > 0:
                  match = tmp[0]
                  return self._qteRegistryMacros[match]
              tmp = [match for match in wid_sig_match if (match[1] == '*')
                     and (match[2] == '*')]
              if len(tmp) > 0:
                  match = tmp[0]
                  return self._qteRegistryMacros[match]
              msg = 'No compatible macro found - should be impossible.'
              self.qteLogger.error(msg, stack_info=True)