import pathlib
import venv


def create_venv(lib_name: str, py_version: str) -> pathlib.Path:
    """
    creates the new virtual environment
    :param lib_name: name of library
    :param py_version: string representation of two-digit python version (ie 37)
    :return: path to venv
    """

    venv_name = f"{lib_name}-go-{py_version}"
    venv_path = pathlib.Path(f"~/venvs/{venv_name}").expanduser()

    try:
        venv_path.mkdir(parents=True, exist_ok=False)
    except FileExistsError as error:
        raise error

    venv.create(env_dir=str(venv_path), with_pip=True, system_site_packages=True)

    return venv_path