code: def fit(self, ctx: Context, train_data, validate_data=None) -> None:
      logger.info(f"enter sample fit")
      if self.hetero_sync:
          logger.info(f"hetero sync")
          logger.info(f"role: {ctx.local.role}")
  
          sampled_data = utils.federated_sample(
              ctx, train_data, role=ctx.local.role
          )
      else:
          # local sample
          logger.info(f"local sample")
          sampled_data = utils.local_sample(
              ctx,
              train_data,
              n=self.n,
              frac=self.frac,
              replace=self.replace,
              random_state=self.random_state,
          )
          """elif self.mode == "weight":
                  if self.n is not None:
                      sampled_data = train_data.sample(n=self.n,
                                                       replace=self.replace,
                                                       weight=train_data.weight,
                                                       random_state=self.random_state)
                  else:
                      sampled_data = train_data.sample(frac=self.frac,
                                                       relace=self.replace,
                                                       weight=train_data.weight,
                                                       random_state=self.random_state)"""
  
      return sampled_data
  
file_path: FATE/python/fate/ml/model_selection/sample.py
imports: import logging
  from fate.arch import Context
  from fate.arch.dataframe import utils
  from ..abc.module import Module
label_desc: Use image node_id 2 for calling the SampleModuleHost obj's underlying member method code with example usage: obj.fit(ctx, train_data, validate_data) and returns: sampled_data