docs: def interact(title, description, prompt, binary, options):
      """Use GPG pinentry program to interact with the user."""
      args = [binary]
      p = subprocess.Popen(args=args,
                           stdin=subprocess.PIPE,
                           stdout=subprocess.PIPE,
                           env=os.environ)
      p.args = args  # TODO: remove after Python 2 deprecation.
      expect(p, [b'OK'])
  
      title = util.assuan_serialize(title.encode('ascii'))
      write(p, b'SETTITLE ' + title + b'\n')
      expect(p, [b'OK'])
  
      if description:
          description = util.assuan_serialize(description.encode('ascii'))
          write(p, b'SETDESC ' + description + b'\n')
          expect(p, [b'OK'])
  
      if prompt:
          prompt = util.assuan_serialize(prompt.encode('ascii'))
          write(p, b'SETPROMPT ' + prompt + b'\n')
          expect(p, [b'OK'])
  
      log.debug('setting %d options', len(options))
      for opt in options:
          write(p, b'OPTION ' + opt + b'\n')
          expect(p, [b'OK', b'ERR'])
  
      write(p, b'GETPIN\n')
      pin = expect(p, [b'OK', b'D '], confidential=True)
  
      p.communicate()  # close stdin and wait for the process to exit
      exit_code = p.wait()
      if exit_code:
          raise subprocess.CalledProcessError(exit_code, binary)
  
      return pin.decode('ascii').strip()