def vendor_site_details_values(data, obj):
    ' Get values from the vendorSiteDetails level of the xml (sub-level of vendor) '
    value_map = {'divisionName': 'division_name', 'divisionNumberOrOfficeCode': 'division_number_or_office', 'vendorAlternateSiteCode': 'vendor_alternate_site_code', 'vendorSiteCode': 'vendor_site_code'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data[key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'is1862LandGrantCollege': 'c1862_land_grant_college', 'is1890LandGrantCollege': 'c1890_land_grant_college', 'is1994LandGrantCollege': 'c1994_land_grant_college', 'isAlaskanNativeServicingInstitution': 'alaskan_native_servicing_i', 'isHistoricallyBlackCollegeOrUniversity': 'historically_black_college', 'isMinorityInstitution': 'minority_institution', 'isNativeHawaiianServicingInstitution': 'native_hawaiian_servicing', 'isPrivateUniversityOrCollege': 'private_university_or_coll', 'isSchoolOfForestry': 'school_of_forestry', 'isStateControlledInstitutionofHigherLearning': 'state_controlled_instituti', 'isTribalCollege': 'tribal_college', 'isVeterinaryCollege': 'veterinary_college'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['typeOfEducationalEntity'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isAirportAuthority': 'airport_authority', 'isCouncilOfGovernments': 'council_of_governments', 'isHousingAuthoritiesPublicOrTribal': 'housing_authorities_public', 'isInterstateEntity': 'interstate_entity', 'isPlanningCommission': 'planning_commission', 'isPortAuthority': 'port_authority', 'isTransitAuthority': 'transit_authority'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['typeOfGovernmentEntity'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isCommunityDevelopedCorporationOwnedFirm': 'community_developed_corpor', 'isForeignGovernment': 'foreign_government', 'isLaborSurplusAreaFirm': 'labor_surplus_area_firm', 'isStateGovernment': 'us_state_government', 'isTribalGovernment': 'us_tribal_government'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorBusinessTypes'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isCorporateEntityNotTaxExempt': 'corporate_entity_not_tax_e', 'isCorporateEntityTaxExempt': 'corporate_entity_tax_exemp', 'isInternationalOrganization': 'international_organization', 'isPartnershipOrLimitedLiabilityPartnership': 'partnership_or_limited_lia', 'isSmallAgriculturalCooperative': 'small_agricultural_coopera', 'isSolePropreitorship': 'sole_proprietorship', 'isUSGovernmentEntity': 'us_government_entity'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorBusinessTypes']['businessOrOrganizationType'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isFederalGovernment': 'us_federal_government', 'isFederalGovernmentAgency': 'federal_agency', 'isFederallyFundedResearchAndDevelopmentCorp': 'federally_funded_research'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorBusinessTypes']['federalGovernment'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isCityLocalGovernment': 'city_local_government', 'isCountyLocalGovernment': 'county_local_government', 'isInterMunicipalLocalGovernment': 'inter_municipal_local_gove', 'isLocalGovernment': 'us_local_government', 'isLocalGovernmentOwned': 'local_government_owned', 'isMunicipalityLocalGovernment': 'municipality_local_governm', 'isSchoolDistrictLocalGovernment': 'school_district_local_gove', 'isTownshipLocalGovernment': 'township_local_government'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorBusinessTypes']['localGovernment'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isDOTCertifiedDisadvantagedBusinessEnterprise': 'dot_certified_disadvantage', 'isSBACertified8AJointVenture': 'sba_certified_8_a_joint_ve', 'isSBACertified8AProgramParticipant': 'c8a_program_participant', 'isSBACertifiedHUBZone': 'historically_underutilized', 'isSBACertifiedSmallDisadvantagedBusiness': 'small_disadvantaged_busine', 'isSelfCertifiedSmallDisadvantagedBusiness': 'self_certified_small_disad'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorCertifications'][key])
        except (KeyError, TypeError):
            obj[value] = None
    try:
        obj['cage_code'] = extract_text(data['entityIdentifiers']['cageCode'])
    except (KeyError, TypeError):
        obj['cage_code'] = None
    value_map = {'DUNSNumber': 'awardee_or_recipient_uniqu', 'globalParentDUNSName': 'ultimate_parent_legal_enti', 'globalParentDUNSNumber': 'ultimate_parent_unique_ide'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['entityIdentifiers']['vendorDUNSInformation'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'UEI': 'awardee_or_recipient_uei', 'ultimateParentUEI': 'ultimate_parent_uei'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['entityIdentifiers']['vendorUEIInformation'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isCommunityDevelopmentCorporation': 'community_development_corp', 'isDomesticShelter': 'domestic_shelter', 'isEducationalInstitution': 'educational_institution', 'isFoundation': 'foundation', 'isHispanicServicingInstitution': 'hispanic_servicing_institu', 'isHospital': 'hospital_flag', 'isManufacturerOfGoods': 'manufacturer_of_goods', 'isVeterinaryHospital': 'veterinary_hospital'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorLineOfBusiness'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'city': 'legal_entity_city_name', 'congressionalDistrictCode': 'legal_entity_congressional', 'countryCode': 'legal_entity_country_code', 'faxNo': 'vendor_fax_number', 'phoneNo': 'vendor_phone_number', 'streetAddress': 'legal_entity_address_line1', 'streetAddress2': 'legal_entity_address_line2', 'streetAddress3': 'legal_entity_address_line3', 'vendorLocationDisabledFlag': 'vendor_location_disabled_f', 'ZIPCode': 'legal_entity_zip4'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorLocation'][key])
        except (KeyError, TypeError):
            obj[value] = None
    key = 'legal_entity_state_code'
    if (obj['legal_entity_country_code'] not in country_code_map):
        key = 'legal_entity_state_descrip'
        obj['legal_entity_state_code'] = None
    else:
        try:
            obj['legal_entity_state_descrip'] = extract_text(data['vendorLocation']['state']['@name'])
        except (KeyError, TypeError):
            obj['legal_entity_state_descrip'] = None
    try:
        obj[key] = extract_text(data['vendorLocation']['state'])
    except (KeyError, TypeError):
        obj[key] = None
    try:
        obj['legal_entity_country_name'] = extract_text(data['vendorLocation']['countryCode']['@name'])
    except (KeyError, TypeError):
        obj['legal_entity_country_name'] = None
    value_map = {'isForeignOwnedAndLocated': 'foreign_owned_and_located', 'isLimitedLiabilityCorporation': 'limited_liability_corporat', 'isShelteredWorkshop': 'the_ability_one_program', 'isSubchapterSCorporation': 'subchapter_s_corporation', 'organizationalType': 'organizational_type'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorOrganizationFactors'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isForProfitOrganization': 'for_profit_organization', 'isNonprofitOrganization': 'nonprofit_organization', 'isOtherNotForProfitOrganization': 'other_not_for_profit_organ'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorOrganizationFactors']['profitStructure'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'receivesContracts': 'contracts', 'receivesContractsAndGrants': 'receives_contracts_and_gra', 'receivesGrants': 'grants'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorRelationshipWithFederalGovernment'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isAlaskanNativeOwnedCorporationOrFirm': 'alaskan_native_owned_corpo', 'isAmericanIndianOwned': 'american_indian_owned_busi', 'isEconomicallyDisadvantagedWomenOwnedSmallBusiness': 'economically_disadvantaged', 'isIndianTribe': 'indian_tribe_federally_rec', 'isJointVentureEconomicallyDisadvantagedWomenOwnedSmallBusiness': 'joint_venture_economically', 'isJointVentureWomenOwnedSmallBusiness': 'joint_venture_women_owned', 'isNativeHawaiianOwnedOrganizationOrFirm': 'native_hawaiian_owned_busi', 'isServiceRelatedDisabledVeteranOwnedBusiness': 'service_disabled_veteran_o', 'isTriballyOwnedFirm': 'tribally_owned_business', 'isVerySmallBusiness': 'emerging_small_business', 'isVeteranOwned': 'veteran_owned_business', 'isWomenOwned': 'woman_owned_business', 'isWomenOwnedSmallBusiness': 'women_owned_small_business'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorSocioEconomicIndicators'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isAsianPacificAmericanOwnedBusiness': 'asian_pacific_american_own', 'isBlackAmericanOwnedBusiness': 'black_american_owned_busin', 'isHispanicAmericanOwnedBusiness': 'hispanic_american_owned_bu', 'isMinorityOwned': 'minority_owned_business', 'isNativeAmericanOwnedBusiness': 'native_american_owned_busi', 'isOtherMinorityOwned': 'other_minority_owned_busin', 'isSubContinentAsianAmericanOwnedBusiness': 'subcontinent_asian_asian_i'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorSocioEconomicIndicators']['minorityOwned'][key])
        except (KeyError, TypeError):
            obj[value] = None
    return obj
Get values from the vendorSiteDetails level of the xml (sub-level of vendor)
def vendor_site_details_values(data, obj):
    '  '
    value_map = {'divisionName': 'division_name', 'divisionNumberOrOfficeCode': 'division_number_or_office', 'vendorAlternateSiteCode': 'vendor_alternate_site_code', 'vendorSiteCode': 'vendor_site_code'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data[key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'is1862LandGrantCollege': 'c1862_land_grant_college', 'is1890LandGrantCollege': 'c1890_land_grant_college', 'is1994LandGrantCollege': 'c1994_land_grant_college', 'isAlaskanNativeServicingInstitution': 'alaskan_native_servicing_i', 'isHistoricallyBlackCollegeOrUniversity': 'historically_black_college', 'isMinorityInstitution': 'minority_institution', 'isNativeHawaiianServicingInstitution': 'native_hawaiian_servicing', 'isPrivateUniversityOrCollege': 'private_university_or_coll', 'isSchoolOfForestry': 'school_of_forestry', 'isStateControlledInstitutionofHigherLearning': 'state_controlled_instituti', 'isTribalCollege': 'tribal_college', 'isVeterinaryCollege': 'veterinary_college'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['typeOfEducationalEntity'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isAirportAuthority': 'airport_authority', 'isCouncilOfGovernments': 'council_of_governments', 'isHousingAuthoritiesPublicOrTribal': 'housing_authorities_public', 'isInterstateEntity': 'interstate_entity', 'isPlanningCommission': 'planning_commission', 'isPortAuthority': 'port_authority', 'isTransitAuthority': 'transit_authority'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['typeOfGovernmentEntity'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isCommunityDevelopedCorporationOwnedFirm': 'community_developed_corpor', 'isForeignGovernment': 'foreign_government', 'isLaborSurplusAreaFirm': 'labor_surplus_area_firm', 'isStateGovernment': 'us_state_government', 'isTribalGovernment': 'us_tribal_government'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorBusinessTypes'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isCorporateEntityNotTaxExempt': 'corporate_entity_not_tax_e', 'isCorporateEntityTaxExempt': 'corporate_entity_tax_exemp', 'isInternationalOrganization': 'international_organization', 'isPartnershipOrLimitedLiabilityPartnership': 'partnership_or_limited_lia', 'isSmallAgriculturalCooperative': 'small_agricultural_coopera', 'isSolePropreitorship': 'sole_proprietorship', 'isUSGovernmentEntity': 'us_government_entity'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorBusinessTypes']['businessOrOrganizationType'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isFederalGovernment': 'us_federal_government', 'isFederalGovernmentAgency': 'federal_agency', 'isFederallyFundedResearchAndDevelopmentCorp': 'federally_funded_research'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorBusinessTypes']['federalGovernment'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isCityLocalGovernment': 'city_local_government', 'isCountyLocalGovernment': 'county_local_government', 'isInterMunicipalLocalGovernment': 'inter_municipal_local_gove', 'isLocalGovernment': 'us_local_government', 'isLocalGovernmentOwned': 'local_government_owned', 'isMunicipalityLocalGovernment': 'municipality_local_governm', 'isSchoolDistrictLocalGovernment': 'school_district_local_gove', 'isTownshipLocalGovernment': 'township_local_government'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorBusinessTypes']['localGovernment'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isDOTCertifiedDisadvantagedBusinessEnterprise': 'dot_certified_disadvantage', 'isSBACertified8AJointVenture': 'sba_certified_8_a_joint_ve', 'isSBACertified8AProgramParticipant': 'c8a_program_participant', 'isSBACertifiedHUBZone': 'historically_underutilized', 'isSBACertifiedSmallDisadvantagedBusiness': 'small_disadvantaged_busine', 'isSelfCertifiedSmallDisadvantagedBusiness': 'self_certified_small_disad'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorCertifications'][key])
        except (KeyError, TypeError):
            obj[value] = None
    try:
        obj['cage_code'] = extract_text(data['entityIdentifiers']['cageCode'])
    except (KeyError, TypeError):
        obj['cage_code'] = None
    value_map = {'DUNSNumber': 'awardee_or_recipient_uniqu', 'globalParentDUNSName': 'ultimate_parent_legal_enti', 'globalParentDUNSNumber': 'ultimate_parent_unique_ide'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['entityIdentifiers']['vendorDUNSInformation'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'UEI': 'awardee_or_recipient_uei', 'ultimateParentUEI': 'ultimate_parent_uei'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['entityIdentifiers']['vendorUEIInformation'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isCommunityDevelopmentCorporation': 'community_development_corp', 'isDomesticShelter': 'domestic_shelter', 'isEducationalInstitution': 'educational_institution', 'isFoundation': 'foundation', 'isHispanicServicingInstitution': 'hispanic_servicing_institu', 'isHospital': 'hospital_flag', 'isManufacturerOfGoods': 'manufacturer_of_goods', 'isVeterinaryHospital': 'veterinary_hospital'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorLineOfBusiness'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'city': 'legal_entity_city_name', 'congressionalDistrictCode': 'legal_entity_congressional', 'countryCode': 'legal_entity_country_code', 'faxNo': 'vendor_fax_number', 'phoneNo': 'vendor_phone_number', 'streetAddress': 'legal_entity_address_line1', 'streetAddress2': 'legal_entity_address_line2', 'streetAddress3': 'legal_entity_address_line3', 'vendorLocationDisabledFlag': 'vendor_location_disabled_f', 'ZIPCode': 'legal_entity_zip4'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorLocation'][key])
        except (KeyError, TypeError):
            obj[value] = None
    key = 'legal_entity_state_code'
    if (obj['legal_entity_country_code'] not in country_code_map):
        key = 'legal_entity_state_descrip'
        obj['legal_entity_state_code'] = None
    else:
        try:
            obj['legal_entity_state_descrip'] = extract_text(data['vendorLocation']['state']['@name'])
        except (KeyError, TypeError):
            obj['legal_entity_state_descrip'] = None
    try:
        obj[key] = extract_text(data['vendorLocation']['state'])
    except (KeyError, TypeError):
        obj[key] = None
    try:
        obj['legal_entity_country_name'] = extract_text(data['vendorLocation']['countryCode']['@name'])
    except (KeyError, TypeError):
        obj['legal_entity_country_name'] = None
    value_map = {'isForeignOwnedAndLocated': 'foreign_owned_and_located', 'isLimitedLiabilityCorporation': 'limited_liability_corporat', 'isShelteredWorkshop': 'the_ability_one_program', 'isSubchapterSCorporation': 'subchapter_s_corporation', 'organizationalType': 'organizational_type'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorOrganizationFactors'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isForProfitOrganization': 'for_profit_organization', 'isNonprofitOrganization': 'nonprofit_organization', 'isOtherNotForProfitOrganization': 'other_not_for_profit_organ'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorOrganizationFactors']['profitStructure'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'receivesContracts': 'contracts', 'receivesContractsAndGrants': 'receives_contracts_and_gra', 'receivesGrants': 'grants'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorRelationshipWithFederalGovernment'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isAlaskanNativeOwnedCorporationOrFirm': 'alaskan_native_owned_corpo', 'isAmericanIndianOwned': 'american_indian_owned_busi', 'isEconomicallyDisadvantagedWomenOwnedSmallBusiness': 'economically_disadvantaged', 'isIndianTribe': 'indian_tribe_federally_rec', 'isJointVentureEconomicallyDisadvantagedWomenOwnedSmallBusiness': 'joint_venture_economically', 'isJointVentureWomenOwnedSmallBusiness': 'joint_venture_women_owned', 'isNativeHawaiianOwnedOrganizationOrFirm': 'native_hawaiian_owned_busi', 'isServiceRelatedDisabledVeteranOwnedBusiness': 'service_disabled_veteran_o', 'isTriballyOwnedFirm': 'tribally_owned_business', 'isVerySmallBusiness': 'emerging_small_business', 'isVeteranOwned': 'veteran_owned_business', 'isWomenOwned': 'woman_owned_business', 'isWomenOwnedSmallBusiness': 'women_owned_small_business'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorSocioEconomicIndicators'][key])
        except (KeyError, TypeError):
            obj[value] = None
    value_map = {'isAsianPacificAmericanOwnedBusiness': 'asian_pacific_american_own', 'isBlackAmericanOwnedBusiness': 'black_american_owned_busin', 'isHispanicAmericanOwnedBusiness': 'hispanic_american_owned_bu', 'isMinorityOwned': 'minority_owned_business', 'isNativeAmericanOwnedBusiness': 'native_american_owned_busi', 'isOtherMinorityOwned': 'other_minority_owned_busin', 'isSubContinentAsianAmericanOwnedBusiness': 'subcontinent_asian_asian_i'}
    for (key, value) in value_map.items():
        try:
            obj[value] = extract_text(data['vendorSocioEconomicIndicators']['minorityOwned'][key])
        except (KeyError, TypeError):
            obj[value] = None
    return obj