/**
  * Adopt specified address object to be compatible with Magento
  *
  * @param Varien_Object $address
  */
 protected function _applyStreetAndRegionWorkarounds(Varien_Object $address)
 {
     // merge street addresses into 1
     if ($address->hasStreet2()) {
         $address->setStreet(implode("\n", array($address->getStreet(), $address->getStreet2())));
         $address->unsStreet2();
     }
     // attempt to fetch region_id from directory
     if ($address->getCountryId() && $address->getRegion()) {
         $regions = Mage::getModel('directory/country')->loadByCode($address->getCountryId())->getRegionCollection()->addRegionCodeOrNameFilter($address->getRegion())->setPageSize(1);
         foreach ($regions as $region) {
             $address->setRegionId($region->getId());
             $address->setExportedKeys(array_merge($address->getExportedKeys(), array('region_id')));
             break;
         }
     }
 }