code: def create_context(pip_version=None, python_version=None):
      
      # determine pip pkg to use for install, and python variants to install on
      if pip_version:
          pip_req = "pip-%s" % str(pip_version)
      else:
          pip_req = "pip"
  
      if python_version:
          ver = Version(str(python_version))
          major_minor_ver = ver.trim(2)
          py_req = "python-%s" % str(major_minor_ver)
      else:
          # use latest major.minor
          package = get_latest_package("python")
          if package:
              major_minor_ver = package.version.trim(2)
          else:
              # no python package. We're gonna fail, let's just choose current
              # python version (and fail at context creation time)
              major_minor_ver = '.'.join(map(str, sys.version_info[:2]))
  
          py_req = "python-%s" % str(major_minor_ver)
  
      # use pip + latest python to perform pip download operations
      request = [pip_req, py_req]
  
      with convert_errors(from_=(PackageFamilyNotFoundError, PackageNotFoundError),
                          to=BuildError, msg="Cannot run - pip or python rez "
                          "package is not present"):
          context = ResolvedContext(request)
  
      # print pip package used to perform the install
      pip_variant = context.get_resolved_package("pip")
      pip_package = pip_variant.parent
      print_info("Using %s (%s)" % (pip_package.qualified_name, pip_variant.uri))
  
      return context
docs: Create a context containing the specific pip and python.
  
      Args:
          pip_version (str or `Version`): Version of pip to use, or latest if None.
          python_version (str or `Version`): Python version to use, or latest if
              None.
  
      Returns:
          `ResolvedContext`: Context containing pip and python.