code: def _get_ip_from_address(address):
      """
      Extract an IP Address object from an address string.
  
      Args:
          address (str): Address (can be IP or IP:port)
  
      Returns:
          An IPv4Address or IPv6Address object.
      """
      ip, _, _ = address.rpartition(":")
      ip = (
          ip or address
      )  # If there was no separation, ip will be empty so use original string
      if ip == "localhost":
          # These should be equivalent
          # `ip_address` will throw an error if given localhost
          ip = "127.0.0.1"
      return ip_address(ip.strip("[]"))
  
imports: from ipaddress import ip_address
  import netifaces
label_desc: Use image node_id 3 for calling a global function with example usage: _get_ip_from_address(address) and returns: ip_address