<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_metadata(pkg_name, metadata_lines):
 """Create a dictionary containing the relevant fields. The following is an example of the generated dictionary: :Example: { 'name': 'six', 'version': '1.11.0', 'repository': 'pypi.python.org/pypi/six', 'licence': 'MIT', 'classifier': 'MIT License' } :param str pkg_name: name of the package :param metadata_lines: metadata resource as list of non-blank non-comment lines :returns: Dictionary of each of the fields :rtype: Dict[str, str] """

    # Initialise a dictionary with all the fields to report on.
    tpip_pkg = dict(
        PkgName=pkg_name,
        PkgType='python package',
        PkgMgrURL='https://pypi.org/project/%s/' % pkg_name,
    )

    # Extract the metadata into a list for each field as there may be multiple
    # entries for each one.
    for line in metadata_lines:
        get_package_info_from_line(tpip_pkg, line)

    # condense PkgAuthorEmail into the Originator field
    if 'PkgAuthorEmail' in tpip_pkg:
        tpip_pkg['PkgOriginator'] = '%s <%s>' % (
            tpip_pkg['PkgOriginator'],
            tpip_pkg.pop('PkgAuthorEmail')
        )

    explicit_license = license_cleanup(tpip_pkg.get('PkgLicense'))
    license_candidates = tpip_pkg.pop('PkgLicenses', [])

    if explicit_license:
        tpip_pkg['PkgLicense'] = explicit_license
    else:
        tpip_pkg['PkgLicense'] = ' '.join(set(license_candidates))

    return tpip_pkg