code: def __connect(host, port, username, password, private_key):
          
          # Initialize the SSH connection
          ssh = paramiko.SSHClient()
          ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
          if private_key is not None and password is not None:
              private_key = paramiko.RSAKey.from_private_key_file(private_key, password)
          elif private_key is not None:
              private_key = paramiko.RSAKey.from_private_key_file(private_key, password)
  
          # Establish the SSH connection
          try:
              ssh.connect(host, port, username, password, private_key)
          except Exception as e:
              raise e
  
          # Return the established SSH connection
          return ssh
docs: Establish remote connection
  
          :param host: Hostname or IP address to connect to
          :param port: Port number to use for SSH
          :param username: Username credentials for SSH access
          :param password: Password credentials for SSH access (or private key passphrase)
          :param private_key: Private key to bypass clear text password
          :return: Paramiko SSH client instance if connection was established
          :raises Exception if connection was unsuccessful