Iterate over cities info and extract useful data

def _process_cities_file(self, file, city_country_mapping):
        """ Iterate over cities info and extract useful data """
        data = {'all_regions': list(), 'regions': list(), 'cities': list(), 'city_region_mapping': dict()}
        allowed_countries = settings.IPGEOBASE_ALLOWED_COUNTRIES
        for geo_info in self._line_to_dict(file, field_names=settings.IPGEOBASE_CITIES_FIELDS):
            country_code = self._get_country_code_for_city(geo_info['city_id'], city_country_mapping, data['all_regions'])
            new_region = {'name': geo_info['region_name'],
                          'country__code': country_code}
            if new_region not in data['all_regions']:
                data['all_regions'].append(new_region)

            if allowed_countries and country_code not in allowed_countries:
                continue

            if new_region not in data['regions']:
                data['regions'].append(new_region)
            data['cities'].append({'region__name': geo_info['region_name'],
                                   'name': geo_info['city_name'],
                                   'id': geo_info['city_id'],
                                   'latitude': Decimal(geo_info['latitude']),
                                   'longitude': Decimal(geo_info['longitude'])})
        return data