def create_context(pip_version=None, python_version=None):
<EOL>if pip_version:<EOL><INDENT>pip_req = "<STR_LIT>" % str(pip_version)<EOL><DEDENT>else:<EOL><INDENT>pip_req = "<STR_LIT>"<EOL><DEDENT>if python_version:<EOL><INDENT>ver = Version(str(python_version))<EOL>major_minor_ver = ver.trim(<NUM_LIT:2>)<EOL>py_req = "<STR_LIT>" % str(major_minor_ver)<EOL><DEDENT>else:<EOL><INDENT>package = get_latest_package("<STR_LIT>")<EOL>if package:<EOL><INDENT>major_minor_ver = package.version.trim(<NUM_LIT:2>)<EOL><DEDENT>else:<EOL><INDENT>major_minor_ver = '<STR_LIT:.>'.join(map(str, sys.version_info[:<NUM_LIT:2>]))<EOL><DEDENT>py_req = "<STR_LIT>" % str(major_minor_ver)<EOL><DEDENT>request = [pip_req, py_req]<EOL>with convert_errors(from_=(PackageFamilyNotFoundError, PackageNotFoundError),<EOL>to=BuildError, msg="<STR_LIT>"<EOL>"<STR_LIT>"):<EOL><INDENT>context = ResolvedContext(request)<EOL><DEDENT>pip_variant = context.get_resolved_package("<STR_LIT>")<EOL>pip_package = pip_variant.parent<EOL>print_info("<STR_LIT>" % (pip_package.qualified_name, pip_variant.uri))<EOL>return context<EOL>
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.