code: def choosePinentry():
      
      pinentries = []
      if 'PINENTRY' in os.environ:
          pinentries.append(Pinentry(os.environ['PINENTRY']))
      else:
          mgrd = yield call('launchctl', 'managername')
          if mgrd == 'Aqua':
              pinentries.extend([
                  Pinentry(
                      '/usr/local/MacGPG2/libexec/pinentry-mac.app'
                      '/Contents/MacOS/pinentry-mac'),
                  Pinentry('pinentry-mac'),
              ])
          if 'DISPLAY' in os.environ:
              pinentries.extend([
                  Pinentry('pinentry-gnome3'),
                  Pinentry('pinentry-x11')
              ])
          pinentries.extend([
              Pinentry('pinentry-curses'),
              Pinentry('pinentry'),
          ])
  
      for pinentry in pinentries:
          try:
              pinentry.argv()
          except (PinentryNotFound, OSError):
              continue
          else:
              return pinentry
      else:
          return GetPassAsker()
docs: Choose a C{pinentry} that can prompt you for a secret.
  
      @return: An argv list suitable for passing to L{ProcessEndpoint}
  
      @raises: L{RuntimeError} if no C{pinentry} is available.
  
      @see:
          U{https://www.gnupg.org/documentation/manuals/gnupg/Common-Problems.html}