factor out the get_ip function