code: def _try_passwordless_openssh(
      server: str, keyfile: str | None
  ) -> bool:
      """Try passwordless login with shell ssh command."""
      if pexpect is None:
          msg = "pexpect unavailable, use paramiko"
          raise ImportError(msg)
      cmd = "ssh -f " + server
      if keyfile:
          cmd += " -i " + keyfile
      cmd += " exit"
  
      # pop SSH_ASKPASS from env
      env = os.environ.copy()
      env.pop("SSH_ASKPASS", None)
  
      ssh_newkey = "Are you sure you want to continue connecting"
      p = pexpect.spawn(cmd, env=env)
      while True:
          try:
              i = p.expect([ssh_newkey, _password_pat], timeout=0.1)
              if i == 0:
                  msg = "The authenticity of the host can't be established."
                  raise SSHException(msg)
          except pexpect.TIMEOUT:
              continue
          except pexpect.EOF:
              return True
          else:
              return False
  
imports: from __future__ import annotations
  import atexit
  import os
  import re
  import signal
  import socket
  import sys
  import warnings
  from getpass import getpass, getuser
  from multiprocessing import Process
  from typing import Any, cast
label_desc: Use image node_id 3 for calling a global function with example usage: _try_passwordless_openssh(server, keyfile) and returns: False, True