Try to get a license from the package.
    Based on https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

    :param pkg:
    :return:

def _get_pkg_license(pkg):
    '''
    Try to get a license from the package.
    Based on https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

    :param pkg:
    :return:
    '''
    licenses = set()
    cpr = "/usr/share/doc/{0}/copyright".format(pkg)
    if os.path.exists(cpr):
        with salt.utils.files.fopen(cpr) as fp_:
            for line in salt.utils.stringutils.to_unicode(fp_.read()).split(os.linesep):
                if line.startswith("License:"):
                    licenses.add(line.split(":", 1)[1].strip())

    return ", ".join(sorted(licenses))