code: def prepare_lightning_trainer(trainer):
      trainer.configure_device()
      trainer._calculate_max_updates()
      trainer.load_metrics()
      trainer._load_loggers()
      trainer._load_trainer()
  
file_path: mmf/tests/trainers/test_utils.py
imports: import os
  import torch
  from mmf.utils.build import build_optimizer
  from mmf.utils.configuration import load_yaml
  from omegaconf import OmegaConf
  from tests.test_utils import SimpleLightningModel, SimpleModel
  from tests.trainers.lightning.lightning_trainer_mock import LightningTrainerMock
  from tests.trainers.test_trainer_mocks import TrainerTrainingLoopMock
label_desc: Use image node_id 7 for calling a global function with example usage: prepare_lightning_trainer(trainer) without return types