code: def address_to_ip(address):
      
      address_parts = address.split(":")
      ip_address = socket.gethostbyname(address_parts[0])
      # Make sure localhost isn't resolved to the loopback ip
      if ip_address == "127.0.0.1":
          ip_address = get_node_ip_address()
      return ":".join([ip_address] + address_parts[1:])
docs: Convert a hostname to a numerical IP addresses in an address.
  
      This should be a no-op if address already contains an actual numerical IP
      address.
  
      Args:
          address: This can be either a string containing a hostname (or an IP
              address) and a port or it can be just an IP address.
  
      Returns:
          The same address but with the hostname replaced by a numerical IP
              address.