code: def __enter__(self):
      retry_counter = 0
      while retry_counter < retry:
          try:
              self.client.connect(
                  hostname=self.hostname,
                  username=self.username,
                  pkey=self.key,
                  timeout=180,
                  auth_timeout=180,
              )
              logger.debug("Connected to AWS instance")
              break
          except pm.ssh_exception.NoValidConnectionsError:
              retry_counter += 1
              logger.warning(
                  "Instance not yet ready for ssh, retry in 30 sec (%d/%d)",
                  retry_counter,
                  retry,
              )
              time.sleep(30)
      if retry_counter == retry:
          logger.fatal(
              "cannot connect to instance, there might be some issues"
          )
          raise EnvironmentError(
              "Failed to start AWS instance with in %d retries" % retry
          )
      return self
  
file_path: auptimizer/src/aup/EE/Resource/AWSResourceManager.py
imports: import logging
  import time
  import boto3
  import paramiko
  from botocore.exceptions import ClientError
  from .SSHResourceManager import SSHResourceManager, Remote, parse_hostname
label_desc: Use image node_id 5 for calling the AWSRemote obj's underlying member method code with example usage: obj.__enter__() and returns: self