def __extract_license(dist):
    """Extracts license information from PKG-INFO metadata. Returns "UNKNOWN" if no license can be found.

    :param dist: the distribution
    :type dist: pkg_resources.Distribution
    :return: license (str) or None
    """
    if not dist.has_metadata('PKG-INFO'):
        return 'UNKNOWN'
    for line in dist.get_metadata_lines('PKG-INFO'):
        try:
            meta_key, meta_value = line.split(': ', 1)
        except ValueError:
            continue
        if meta_key == 'License':
            return meta_value
