def METHOD_NAME(self, attrs):
    interface = attrs["interface"]
    attributes = [
        attribute for attribute in attrs if attribute != "interface"
    ]
    if len(attributes) > 1:
        raise serializers.ValidationError(
            "Only one of image, value, user_upload and "
            "upload_session should be set."
        )
    if interface.is_image_kind:
        if not attrs.get("image") and not attrs.get("upload_session"):
            raise serializers.ValidationError(
                f"upload_session or image are required for interface "
                f"kind {interface.kind}"
            )
    if not attrs.get("upload_session") and not attrs.get("user_upload"):
        # Instances without an image or a file are never valid, this will be checked
        # later, but for now check everything else. DRF 3.0 dropped calling
        # full_clean on instances, so we need to do it ourselves.
        instance = ComponentInterfaceValue(
            **{k: v for k, v in attrs.items() if k != "upload_session"}
        )
        instance.full_clean()
    if interface.requires_file:
        if not attrs.get("user_upload"):
            raise serializers.ValidationError(
                f"user_upload is required for interface "
                f"kind {interface.kind}"
            )
    return attrs