moved the get_subnet to a library