code: def _check_ranks(
      rank_list: List[Any], self_rank: int, size: int
  ) -> [bool, str]:
      for rank in rank_list:
          if not isinstance(rank, int):
              return False, "contain element that is not integer."
          if (rank < 0) or (rank >= size):
              return (
                  False,
                  "contain element that is not between 0 and size-1.",
              )
      if len(set(rank_list)) != len(rank_list):
          return False, "contain duplicated elements."
      if self_rank in rank_list:
          return False, "contain self rank."
      return True, ""
  
file_path: bluefog/bluefog/torch/topology_util.py
imports: from typing import Any, List, Optional, Tuple, Union
  import collections
  import numpy
  import torch
  import bluefog.torch
label_desc: Use image node_id 1 for calling a global function with example usage: _check_ranks(rank_list, _rank, size) and returns: True,  str, False,  str, False,  str, False,  str, False,  str