code: def pypi_module_version_is_available(module, version):
      "Check whether module==version is available on pypi"
      # returns True/False (or None if failed to execute the check)
  
      # using a hack that when passing "module==" w/ no version number to pip
      # it "fails" and returns all the available versions in stderr
      try:
          cmd = f"pip install {module}=="
          result = subprocess.run(cmd.split(), shell=False, check=False,
                                  stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      except Exception as e:
          print(f"Error: {e}")
          return None
      else:
          if result.returncode == 1 and result.stderr:
              output = result.stderr.decode('utf-8')
              return True if version in output else False
          else:
              print(f"Some error in {cmd}")
              return Nonf pypi_module_version_is_available(module, version):
      "Check whether module==version is available on pypi"
      # returns True/False (or None if failed to execute the check)
  
      # using a hack that when passing "module==" w/ no version number to pip
      # it "fails" and returns all the available versions in stderr
      try:
          cmd = f"pip install {module}=="
          result = subprocess.run(cmd.split(), shell=False, check=False,
                                  stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      except Exception as e:
          print(f"Error: {e}")
          return None
      else:
          if result.returncode == 1 and result.stderr:
              output = result.stderr.decode('utf-8')
              return True if version in output else False
          else:
              print(f"Some error in {cmd}")
              return None
docs: Check whether module==version is available on pypi