code: def _check_rank_and_size_consistent_with_horovod(
      petastorm_reader_kwargs,
  ):
      """Check whether the ``cur_shard`` and ``shard_count`` args are consistent with horovod environment variables.
  
      If not consistent with horovod environment variables, log warning message and return ``False``.
      If there're no related horovod environment variable set, return ``True``.
      """
      hvd_rank, hvd_size = _get_horovod_rank_and_size()
      cur_shard = petastorm_reader_kwargs.get("cur_shard")
      shard_count = petastorm_reader_kwargs.get("shard_count")
  
      if hvd_rank is not None and hvd_size is not None:
          if cur_shard != hvd_rank or shard_count != hvd_size:
              logger.warning(
                  "The petastorm reader arguments cur_shard(%d) and "
                  "shard_count(%d) is not consistent with horovod "
                  "environments hvd_rank(%d) and hvd_size(%d), If you want "
                  "each horovod worker train on one corresponding shard data, "
                  "you should set argument `cur_shard` to be `hvd.rank()` "
                  "and argument `shard_count` to be `hvd.size()`.",
                  cur_shard,
                  shard_count,
                  hvd_rank,
                  hvd_size,
              )
              return False
      return True
  
imports: import atexit
  import datetime
  import logging
  import os
  import shutil
  import threading
  import time
  import uuid
  from distutils.version import LooseVersion
  from multiprocessing.pool import ThreadPool
  from typing import List, Any
  import pyspark
  from pyarrow import LocalFileSystem
  from pyspark.sql.session import SparkSession
  from pyspark.sql.types import ArrayType, DoubleType, FloatType
  from six.moves.urllib.parse import urlparse
  from petastorm import make_batch_reader
  from petastorm.fs_utils import FilesystemResolver, get_filesystem_and_path_or_paths, normalize_dir_url
  from fsspec.core import strip_protocol
label_desc: Use image node_id 7 for calling a global function with example usage: _check_rank_and_size_consistent_with_horovod(petastorm_reader_kwargs) and returns: True, False