def METHOD_NAME(address_format_type: str, address_data_dict: dict, address_key_prefix: str):
    result = ''
    if address_format_type == AddressFormatType.FOREIGN:
        addr_line_2_key = f'{address_key_prefix}addr_line_2'
        addr_line_3_key = f'{address_key_prefix}addr_line_3'
        addr_line_2 = address_data_dict[addr_line_2_key]
        addr_line_3 = address_data_dict[addr_line_3_key]
        addr_line_2 = addr_line_2 if addr_line_2 else ''
        addr_line_2 = addr_line_2.strip()
        addr_line_3 = addr_line_3 if addr_line_3 else ''
        result = f'{addr_line_2} {addr_line_3}'
    elif address_format_type == AddressFormatType.ADVANCED:
        route_service_type_key = f'{address_key_prefix}route_service_type'
        lock_box_no_key = f'{address_key_prefix}lock_box_no'
        route_service_no_key = f'{address_key_prefix}route_service_no'
        installation_type_key = f'{address_key_prefix}installation_type'
        installation_name_key = f'{address_key_prefix}installation_name'
        street_additional_elements = [address_data_dict[route_service_type_key],
                                   address_data_dict[lock_box_no_key],
                                   address_data_dict[route_service_no_key],
                                   address_data_dict[installation_type_key],
                                   address_data_dict[installation_name_key]]
        for element in street_additional_elements:
            if element:
                result += f' {element}'
    result = result.strip()
    return result