code: def apply(self, doc, split, train, **kwargs):
          
          logger.debug(f"Document: {doc}")
  
          # Get all the candidates in this doc that will be featurized
          cands_list = get_cands_list_from_split(
              self.session, self.candidate_classes, doc, split
          )
  
          feature_map = dict()
  
          # Make a flat list of all candidates from the list of list of
          # candidates. This helps reduce the number of queries needed to update.
          all_cands = itertools.chain.from_iterable(cands_list)
          records = list(
              get_mapping(self.session, Feature, all_cands, get_all_feats, feature_map)
          )
          batch_upsert_records(self.session, Feature, records)
  
          # Insert all Feature Keys
          if train:
              upsert_keys(self.session, FeatureKey, feature_map)
  
          # This return + yield makes a completely empty generator
          return
          yield
docs: Extract candidates from the given Context.
  
          :param doc: A document to process.
          :param split: Which split to use.
          :param train: Whether or not to insert new FeatureKeys.