gateway_ip is set in _make_subnet_dict.. and I don't think _subnet_dict is called outside of _make_subnet_dict anymore so you might want to just merge those two functions.