'Returns the path to the current virtualenv'

@staticmethod
def get_current_venv():

    if ('VIRTUAL_ENV' in os.environ):
        venv = os.environ['VIRTUAL_ENV']
    elif os.path.exists('.python-version'):
        try:
            subprocess.check_output('pyenv    help', stderr=subprocess.STDOUT)
        except OSError:
            print("This    directory    seems    to    have    pyenv's    local    venv,    but    pyenv    executable    was    not    found.")
        with open('.python-version', 'r') as f:
            env_name = f.readline().strip()
        bin_path = subprocess.check_output(['pyenv', 'which', 'python']).decode('utf-8')
        venv = (bin_path[:bin_path.rfind(env_name)] + env_name)
    else:
        return None
    return venv
