def _clean_segmentation_id(self, data):
        network_type = data.get('network_type')
        if 'segmentation_id' in self._errors:
            if ['local', 'flat'] in network_type:
                # In this case the segmentation ID is not required, so we can
                # ignore any errors.
                del self._errors['segmentation_id']
        elif network_type in ['vlan', 'gre', 'vxlan']:
            seg_id = data.get('segmentation_id')
            seg_id_range = {'min': self.seg_id_range[network_type][0],
                            'max': self.seg_id_range[network_type][1]}
            if seg_id < seg_id_range['min'] or seg_id > seg_id_range['max']:
                if network_type == 'vlan':
                    msg = _('For VLAN networks, valid VLAN IDs are %(min)s '
                            'through %(max)s.') % seg_id_range
                elif network_type == 'gre':
                    msg = _('For GRE networks, valid tunnel IDs are %(min)s '
                            'through %(max)s.') % seg_id_range
                elif network_type == 'vxlan':
                    msg = _('For VXLAN networks, valid tunnel IDs are %(min)s '
                            'through %(max)s.') % seg_id_range
                self._errors['segmentation_id'] = self.error_class([msg])
dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/dashboards/admin/networks/forms.py/CreateNetwork._clean_segmentation_id/swapped operands of `in`