code: def connect_to_gateway(
      self,
      via_client: Optional[SyftClient] = None,
      url: Optional[str] = None,
      port: Optional[int] = None,
      handle: Optional[NodeHandle] = None,  # noqa: F821
      email: Optional[str] = None,
      password: Optional[str] = None,
  ) -> None:
      if via_client is not None:
          client = via_client
      elif handle is not None:
          client = handle.client
      else:
          client = (
              login_as_guest(url=url, port=port)
              if email is None
              else login(
                  url=url, port=port, email=email, password=password
              )
          )
          if isinstance(client, SyftError):
              return client
  
      res = self.exchange_route(client)
      if isinstance(res, SyftSuccess):
          return SyftSuccess(
              message=f"Connected {self.metadata.node_type} to {client.name} gateway"
          )
      return res
  
imports: from __future__ import annotations
  from typing import Optional
  from typing import TYPE_CHECKING
  from ..abstract_node import NodeSideType
  from ..client.api import APIRegistry
  from ..img.base64 import base64read
  from ..serde.serializable import serializable
  from ..service.network.routes import NodeRouteType
  from ..service.response import SyftError
  from ..service.response import SyftSuccess
  from ..types.syft_object import SYFT_OBJECT_VERSION_1
  from ..types.syft_object import SyftObject
  from ..types.uid import UID
  from ..util.fonts import fonts_css
  from .api import APIModule
  from .client import SyftClient
  from .client import login
  from .client import login_as_guest
label_desc: Use image node_id 3 for calling the EnclaveClient obj's underlying member method code with example usage: obj.connect_to_gateway(via_client, url, port, handle, email, password) and returns: res, SyftSuccess, client