code: def _connect_ssh(spec):
      
      if C.HOST_KEY_CHECKING:
          check_host_keys = 'enforce'
      else:
          check_host_keys = 'ignore'
  
      # #334: tilde-expand private_key_file to avoid implementation difference
      # between Python and OpenSSH.
      private_key_file = spec.private_key_file()
      if private_key_file is not None:
          private_key_file = os.path.expanduser(private_key_file)
  
      return {
          'method': 'ssh',
          'kwargs': {
              'check_host_keys': check_host_keys,
              'hostname': spec.remote_addr(),
              'username': spec.remote_user(),
              'compression': convert_bool(
                  default(spec.mitogen_ssh_compression(), True)
              ),
              'password': spec.password(),
              'port': spec.port(),
              'python_path': spec.python_path(),
              'identity_file': private_key_file,
              'identities_only': False,
              'ssh_path': spec.ssh_executable(),
              'connect_timeout': spec.ansible_ssh_timeout(),
              'ssh_args': spec.ssh_args(),
              'ssh_debug_level': spec.mitogen_ssh_debug_level(),
              'remote_name': get_remote_name(spec),
          }
      }
docs: Return ContextService arguments for an SSH connection.