def METHOD_NAME(self, batch, request):
    start = time.time()
    if self.spawn_subprocess:
        self.batch_in.put((batch, request))
        try:
            out = self.worker.get()
        except WorkersDied:
            raise TrainProcessDied()
        for array_key in self.provided_arrays:
            if array_key in request:
                batch.arrays[array_key] = out.arrays[array_key]
        batch.loss = out.loss
        batch.iteration = out.iteration
    else:
        self.train_step(batch, request)
    time_of_iteration = time.time() - start
    logger.info(
        "Train process: iteration=%d loss=%f time=%f",
        batch.iteration,
        batch.loss,
        time_of_iteration,
    )