code: def parse_hostname(host):
      """
      Parse the host name, in the following formats:
  
      + `username@ip` or
      + `username@ip:port` or
      + `username@ip ssh_key` or
      + `username@ip:port ssh_key`
  
      :param host: host name string
      :type host: str
      :return: username, hostname, port=22, key (parsed from ~/.ssh/id_rsa)
      """
      if "@" not in host:
          logger.fatal("Username@IP is minimal requirement")
          raise ValueError("host name %s is not correct" % host)
      try:
          username, hostname = host.split("@")
          if " " in hostname:
              hostname, key = hostname.split(" ")
              key = pm.RSAKey.from_private_key_file(key)
          else:
              key = None  # use default
          if ":" in hostname:
              hostname, port = hostname.split(":")
              port = int(port)
          else:
              hostname = hostname
              port = 22
      except Exception as e:
          logger.fatal(
              "Catch other error when parsing the remote resource configuration.  Check documentation please."
          )
          raise e
      return username, hostname, port, key
  
imports: import json
  import logging
  import os
  import sys
  import time
  import threading
  import paramiko
  from .CPUResourceManager import CPUResourceManager
  from ...utils import check_missing_key, load_default_env, parse_result, DEFAULT_AUPTIMIZER_PATH, block_until_ready
  from ...utils import open_sftp_with_timeout, parse_one_line
  from ..Job import Job
label_desc: Use image node_id 1 for calling a global function with example usage: parse_hostname(host) and returns: username,  hostname,  port,  key