code: def get_topology(mp, pp, world_size):
      assert world_size % (pp * mp) == 0
      dp = world_size // (pp * mp)
  
      from deepspeed.runtime.pipe.topology import (
          PipeModelDataParallelTopology,
      )
  
      topo = PipeModelDataParallelTopology(
          num_pp=pp, num_mp=mp, num_dp=dp
      )
  
      return topo
  
imports: import os
  import torch
  import deepspeed
  import pytest
  import random
  import numpy
  import deepspeed.comm
  from unit.common import DistributedTest, DistributedFixture
  from unit.megatron_model import get_megatron_version
  from unit.megatron_model import MockGPT2ModelPipe
  from deepspeed.utils import RepeatingLoader
  from deepspeed.accelerator import get_accelerator
  from deepspeed.runtime.utils import required_torch_version
label_desc: Use image node_id 2 for calling a global function with example usage: get_topology(mp, pp, world_size) and returns: topo