code: def get_best_ip(last_ip, next_ip):
      
      if last_ip is None:
          return next_ip
      if is_public_ip(last_ip) and not is_public_ip(next_ip):
          return last_ip
      if is_private_ip(last_ip) and is_loopback_ip(next_ip):
          return last_ip
      return next_ip
docs: Given two IP addresses, it returns the the best match ip.
      Order of precedence is (Public, Private, Loopback, None)
      Right-most IP is returned