class_docstr: Class describing basic methods that package should provide
  
  Parameters
  ----------
  `key`: str
      Name this package should be queried for
  `versions`: str or PckgVer class object
      List of versions this package is available for
  `name`: str, optional, default = None
      Name of this package used during installation. If empty it is the same as the key
class_docstr_tok: ["Class","describing","basic","methods","that","package","should","provide","Parameters","--","--","--","--","--","`","key","`",":","str","Name","this","package","should","be","queried","for","`","versions","`",":","str","or","PckgVer","class","object","List","of","versions","this","package","is","available","for","`","name","`",":","str",",","optional",",","default","=","None","Name","of","this","package","used","during","installation",".","If","empty","it","is","the","same","as","the","key"]
docstr: Clamps index to range 0 - num_of_packages - 1
  
  Parameters
  ----------
  `key`: idx: int
      Index to clamp
  `cuda_version`: str, optional, default = None
      Cuda version used for a given index
docstr_tok: ["Clamps","index","to","range","0","-","num_of_packages","-","1","Parameters","--","--","--","--","--","`","key","`",":","idx",":","int","Index","to","clamp","`","cuda_version","`",":","str",",","optional",",","default","=","None","Cuda","version","used","for","a","given","index"]
code: def clamp_index(self, idx, cuda_version=None):
      """Clamps index to range 0 - num_of_packages - 1
  
      Parameters
      ----------
      `key`: idx: int
          Index to clamp
      `cuda_version`: str, optional, default = None
          Cuda version used for a given index
      """
      if idx < 0 or idx >= self.get_num_of_version(cuda_version):
          idx = 0
      return idx
  
imports: import argparse
  import sys
  from pip._vendor.packaging.version import parse
  import urllib.parse
  from urllib.request import urlopen, HTTPError, Request, URLError
label_desc: Use image node_id 2 for calling the BasePackage obj's underlying member method code with example usage: obj.clamp_index(idx, cuda_version) and returns: idx