def METHOD_NAME(self, args):
    if hasattr(args, "enable_defense") and args.enable_defense:
        self.args = args
        logging.info("------init defense..." + args.defense_type)
        self.is_enabled = True
        self.defense_type = args.defense_type.strip()
        logging.info("self.defense_type = {}".format(self.defense_type))
        self.defender = None
        if self.defense_type == DEFENSE_NORM_DIFF_CLIPPING:
            self.defender = NormDiffClippingDefense(args)
        elif self.defense_type == DEFENSE_ROBUST_LEARNING_RATE:
            self.defender = RobustLearningRateDefense(args)
        elif self.defense_type in [DEFENSE_KRUM, DEFENSE_MULTIKRUM]:
            self.defender = KrumDefense(args)
        elif self.defense_type == DEFENSE_SLSGD:
            self.defender = SLSGDDefense(args)
        elif self.defense_type == DEFENSE_GEO_MEDIAN:
            self.defender = GeometricMedianDefense(args)
        elif self.defense_type == DEFENSE_WEAK_DP:
            self.defender = WeakDPDefense(args)
        elif self.defense_type == DEFENSE_CCLIP:
            self.defender = CClipDefense(args)
        elif self.defense_type == DEFENSE_WISE_MEDIAN:
            self.defender = CoordinateWiseMedianDefense(args)
        elif self.defense_type == DEFENSE_RFA:
            self.defender = RFADefense(args)
        elif self.defense_type == DEFENSE_FOOLSGOLD:
            self.defender = FoolsGoldDefense(args)
        elif self.defense_type == DEFENSE_THREESIGMA:
            self.defender = ThreeSigmaDefense(args)
        elif self.defense_type == DEFENSE_THREESIGMA_GEOMEDIAN:
            self.defender = ThreeSigmaGeoMedianDefense(args)
        elif self.defense_type == DEFENSE_THREESIGMA_KRUM:
            self.defender = ThreeSigmaKrumDefense(args)
        elif self.defense_type == DEFENSE_CRFL:
            self.defender = CRFLDefense(args)
        elif self.defense_type == DEFENSE_TRIMMED_MEAN:
            self.defender = CoordinateWiseTrimmedMeanDefense(args)
        elif self.defense_type == ANOMALY_DETECTION:
            self.defender = OutlierDetection(args)
        else:
            raise Exception("args.defense_type is not defined!")
    else:
        self.is_enabled = False
    if (
        self.is_enabled
        and hasattr(args, MLEngineBackend.ml_engine_args_flag)
        and args.ml_engine
        in [
            MLEngineBackend.ml_engine_backend_tf,
            MLEngineBackend.ml_engine_backend_jax,
            MLEngineBackend.ml_engine_backend_mxnet,
        ]
    ):
        logging.info(
            "FedMLDefender is not supported for the machine learning engine: %s. "
            "We will support more engines in the future iteration." % args.ml_engine
        )
        self.is_enabled = False