Factor out code for finding availability zones.