code: def get_neighbors_count(comm):
      topo = comm.Get_topology()
      if topo == MPI.CART:
          ndim = comm.Get_dim()
          return 2 * ndim, 2 * ndim
      if topo == MPI.GRAPH:
          rank = comm.Get_rank()
          nneighbors = comm.Get_neighbors_count(rank)
          return nneighbors, nneighbors
      if topo == MPI.DIST_GRAPH:
          indeg, outdeg, w = comm.Get_dist_neighbors_count()
          return indeg, outdeg
      return 0, 0
  
imports: from mpi4py import MPI
  import mpiunittest
  import arrayimpl
label_desc: Use image node_id 2 for calling a global function with example usage: get_neighbors_count(comm) and returns: int,  int, unknown,  unknown, nneighbors,  nneighbors, indeg,  outdeg