Return the path to a package resource installed inside a virtualenv

    .. versionadded:: 2015.5.0

    venv
        Path to the virtualenv

    package
        Name of the package in which the resource resides

        .. versionadded:: 2016.3.0

    resource
        Name of the resource of which the path is to be returned

        .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' virtualenv.get_resource_path /path/to/my/venv my_package my/resource.xml

def get_resource_path(venv,
                      package=None,
                      resource=None):
    '''
    Return the path to a package resource installed inside a virtualenv

    .. versionadded:: 2015.5.0

    venv
        Path to the virtualenv

    package
        Name of the package in which the resource resides

        .. versionadded:: 2016.3.0

    resource
        Name of the resource of which the path is to be returned

        .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' virtualenv.get_resource_path /path/to/my/venv my_package my/resource.xml
    '''
    _verify_safe_py_code(package, resource)
    bin_path = _verify_virtualenv(venv)

    ret = __salt__['cmd.exec_code_all'](
        bin_path,
        'import pkg_resources; '
            "print(pkg_resources.resource_filename('{0}', '{1}'))".format(
                package,
                resource
        )
    )

    if ret['retcode'] != 0:
        raise CommandExecutionError('{stdout}\n{stderr}'.format(**ret))

    return ret['stdout']