def clean(self):
        data = super(CreateImageForm, self).clean()

        # The image_file key can be missing based on particular upload
        # conditions. Code defensively for it here...
        image_file = data.get('image_file', None)

        if not data['copy_from'] and not image_file:
            raise ValidationError(
                _("A image or external image location must be specified."))
        elif data['copy_from'] and image_file:
            raise ValidationError(
                _("Can not specify both image and external image location."))
        else:
            return data
dataset/ETHPy150Open Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py/CreateImageForm.clean/original