def headerize(provenances):
    """Create a header for each keyword.

    :param provenances: The keywords.
    :type provenances: dict

    :return: New keywords with header for every keyword.
    :rtype: dict
    """

    special_case = {
        'Inasafe': 'InaSAFE',
        'Qgis': 'QGIS',
        'Pyqt': 'PyQt',
        'Os': 'OS',
        'Gdal': 'GDAL',
        'Maps': 'Map'
    }
    for key, value in list(provenances.items()):
        if '_' in key:
            header = key.replace('_', ' ').title()
        else:
            header = key.title()

        header_list = header.split(' ')
        proper_word = None
        proper_word_index = None
        for index, word in enumerate(header_list):
            if word in list(special_case.keys()):
                proper_word = special_case[word]
                proper_word_index = index

        if proper_word:
            header_list[proper_word_index] = proper_word

        header = ' '.join(header_list)

        provenances.update(
            {
                key: {
                    'header': '{header} '.format(header=header),
                    'content': value
                }
            })

    return provenances
def headerize ( provenances ) : special_case = { 'Inasafe' : 'InaSAFE' , 'Qgis' : 'QGIS' , 'Pyqt' : 'PyQt' , 'Os' : 'OS' , 'Gdal' : 'GDAL' , 'Maps' : 'Map' } for key , value in list ( provenances . items ( ) ) : if '_' in key : header = key . replace ( '_' , ' ' ) . title ( ) else : header = key . title ( ) header_list = header . split ( ' ' ) proper_word = None proper_word_index = None for index , word in enumerate ( header_list ) : if word in list ( special_case . keys ( ) ) : proper_word = special_case [ word ] proper_word_index = index if proper_word : header_list [ proper_word_index ] = proper_word header = ' ' . join ( header_list ) provenances . update ( { key : { 'header' : '{header} ' . format ( header = header ) , 'content' : value } } ) return provenances
Create a header for each keyword.

    :param provenances: The keywords.
    :type provenances: dict

    :return: New keywords with header for every keyword.
    :rtype: dict