def clean_entry(entry):
    """Consolidate some entry attributes and rename a few others.

    Consolidate address attributes into a single field and replace some field
    names with others as described in FIELD_TRANSFORM_INDEX.

    @param entry: The entry attributes to update.
    @type entry: dict
    @return: Entry copy after running clean operations
    @rtype: dict
    """
    newEntry = {}

    if 'Address1' in entry:
        address = str(entry['Address1'])
        if entry['Address2'] != '':
            address = address + ' ' + str(entry['Address2'])
        newEntry['address'] = address
        del entry['Address1']
        del entry['Address2']

    for key in entry.keys():

        if key != None:
        
            if key in FIELD_TRANSFORM_INDEX:
                newKey = FIELD_TRANSFORM_INDEX[key]
            else:
                newKey = key
            
            newKey = newKey[:1].lower() + newKey[1:]
            newEntry[newKey] = entry[key]

    return newEntry
def clean_entry ( entry ) : newEntry = { } if 'Address1' in entry : address = str ( entry [ 'Address1' ] ) if entry [ 'Address2' ] != '' : address = address + ' ' + str ( entry [ 'Address2' ] ) newEntry [ 'address' ] = address del entry [ 'Address1' ] del entry [ 'Address2' ] for key in entry . keys ( ) : if key != None : if key in FIELD_TRANSFORM_INDEX : newKey = FIELD_TRANSFORM_INDEX [ key ] else : newKey = key newKey = newKey [ : 1 ] . lower ( ) + newKey [ 1 : ] newEntry [ newKey ] = entry [ key ] return newEntry
Consolidate some entry attributes and rename a few others.

    Consolidate address attributes into a single field and replace some field
    names with others as described in FIELD_TRANSFORM_INDEX.

    @param entry: The entry attributes to update.
    @type entry: dict
    @return: Entry copy after running clean operations
    @rtype: dict