def calculate_ppop_fields(obj, sess, county_by_name, county_by_code, state_code_list, country_list):
    " calculate values that aren't in any feed (or haven't been provided properly) for place of performance "
    if (obj['place_of_perform_country_c'] in country_code_map):
        if (obj['place_of_perform_country_c'] != 'USA'):
            obj['place_of_performance_state'] = country_code_map[obj['place_of_perform_country_c']]
            if (obj['place_of_performance_state'] in state_code_list):
                obj['place_of_perfor_state_desc'] = state_code_list[obj['place_of_performance_state']]
            obj['place_of_perform_country_c'] = 'USA'
            obj['place_of_perf_country_desc'] = 'UNITED STATES'
        if (obj['place_of_performance_state'] and (not obj['place_of_perfor_state_desc']) and (obj['place_of_performance_state'] in state_code_list)):
            obj['place_of_perfor_state_desc'] = state_code_list[obj['place_of_performance_state']]
        if (obj['place_of_perform_county_na'] and obj['place_of_performance_state']):
            state = obj['place_of_performance_state']
            county_name = obj['place_of_perform_county_na']
            if ((state in county_by_name) and (county_name in county_by_name[state])):
                obj['place_of_perform_county_co'] = county_by_name[state][county_name]
        if ((not obj['place_of_perform_county_co']) and obj['place_of_performance_zip4a']):
            obj['place_of_perform_county_co'] = get_county_by_zip(sess, obj['place_of_performance_zip4a'])
        if ((not obj['place_of_perform_county_na']) and (obj['place_of_performance_state'] in county_by_code) and (obj['place_of_perform_county_co'] in county_by_code[obj['place_of_performance_state']])):
            obj['place_of_perform_county_na'] = county_by_code[obj['place_of_performance_state']][obj['place_of_perform_county_co']]
        if (obj['place_of_performance_zip4a'] and is_valid_zip(obj['place_of_performance_zip4a'])):
            obj['place_of_performance_zip5'] = obj['place_of_performance_zip4a'][:5]
            if (len(obj['place_of_performance_zip4a']) > 5):
                obj['place_of_perform_zip_last4'] = obj['place_of_performance_zip4a'][(- 4):]
    if ((not obj['place_of_perf_country_desc']) and (obj['place_of_perform_country_c'] in country_list)):
        obj['place_of_perf_country_desc'] = country_list[obj['place_of_perform_country_c']]
calculate values that aren't in any feed (or haven't been provided properly) for place of performance
def calculate_ppop_fields(obj, sess, county_by_name, county_by_code, state_code_list, country_list):
    "  "
    if (obj['place_of_perform_country_c'] in country_code_map):
        if (obj['place_of_perform_country_c'] != 'USA'):
            obj['place_of_performance_state'] = country_code_map[obj['place_of_perform_country_c']]
            if (obj['place_of_performance_state'] in state_code_list):
                obj['place_of_perfor_state_desc'] = state_code_list[obj['place_of_performance_state']]
            obj['place_of_perform_country_c'] = 'USA'
            obj['place_of_perf_country_desc'] = 'UNITED STATES'
        if (obj['place_of_performance_state'] and (not obj['place_of_perfor_state_desc']) and (obj['place_of_performance_state'] in state_code_list)):
            obj['place_of_perfor_state_desc'] = state_code_list[obj['place_of_performance_state']]
        if (obj['place_of_perform_county_na'] and obj['place_of_performance_state']):
            state = obj['place_of_performance_state']
            county_name = obj['place_of_perform_county_na']
            if ((state in county_by_name) and (county_name in county_by_name[state])):
                obj['place_of_perform_county_co'] = county_by_name[state][county_name]
        if ((not obj['place_of_perform_county_co']) and obj['place_of_performance_zip4a']):
            obj['place_of_perform_county_co'] = get_county_by_zip(sess, obj['place_of_performance_zip4a'])
        if ((not obj['place_of_perform_county_na']) and (obj['place_of_performance_state'] in county_by_code) and (obj['place_of_perform_county_co'] in county_by_code[obj['place_of_performance_state']])):
            obj['place_of_perform_county_na'] = county_by_code[obj['place_of_performance_state']][obj['place_of_perform_county_co']]
        if (obj['place_of_performance_zip4a'] and is_valid_zip(obj['place_of_performance_zip4a'])):
            obj['place_of_performance_zip5'] = obj['place_of_performance_zip4a'][:5]
            if (len(obj['place_of_performance_zip4a']) > 5):
                obj['place_of_perform_zip_last4'] = obj['place_of_performance_zip4a'][(- 4):]
    if ((not obj['place_of_perf_country_desc']) and (obj['place_of_perform_country_c'] in country_list)):
        obj['place_of_perf_country_desc'] = country_list[obj['place_of_perform_country_c']]