/**
  * @param int $partner_id
  * @return conversionProfile2
  */
 public static function getConversionProfile2ForPartner($partner_id, $conversionProfile2Id = null)
 {
     if ($conversionProfile2Id == conversionProfile2::CONVERSION_PROFILE_NONE) {
         return null;
     }
     if (!$conversionProfile2Id) {
         // try to extract the conversion profile from the partner
         $partner = PartnerPeer::retrieveByPK($partner_id);
         if (!$partner) {
             throw new Exception("Cannot find partner for id [{$partner_id}]");
         }
         $partner_kmc_version = $partner->getKmcVersion();
         if (is_null($partner_kmc_version) || version_compare($partner_kmc_version, "2", "<")) {
             $old_conversion_profile = self::getCurrentConversionProfile($partner->getId());
             if (!$old_conversion_profile) {
                 throw new Exception("Cannot find conversion profile for partner id [{$partner_id}]");
             }
             return myConversionProfileUtils::createConversionProfile2FromConversionProfile($old_conversion_profile);
         }
         $conversionProfile2Id = $partner->getDefaultConversionProfileId();
     }
     return conversionProfile2Peer::retrieveByPk($conversionProfile2Id);
 }
        KalturaLog::debug("Partner was set with DefaultConversionProfileId: " . $partner->getDefaultConversionProfileId());
        $partner->setKmcVersion('4');
        $partner->save();
        die;
    }
} else {
    // no currentConversionProfileType, lets see what on default
    $defConversionProfileType = $partner->getFromCustomData('defConversionProfileType');
    if (!is_null($defConversionProfileType)) {
        $oldCp = myConversionProfileUtils::getConversionProfile($partner->getId(), $defConversionProfileType);
        if (!$oldCp->getConversionProfile2Id() && $oldCp->getPartnerId() == $partner->getId()) {
            if (DEBUG) {
                KalturaLog::debug("This was dry-run, going to convert old default conversion profile according to defConversionProfileType");
                die;
            } else {
                myConversionProfileUtils::createConversionProfile2FromConversionProfile($oldCp);
                // set new id on defaultConversionProfileId
                $partner->setDefaultConversionProfileId($oldCp->getConversionProfile2Id());
                $partner->setKmcVersion('4');
                $partner->save();
                KalturaLog::debug("converted old default conversion profile. new DefaultConversionProfileId is: " . $partner->getDefaultConversionProfileId());
                die;
            }
        }
    }
}
// if we didn't exit so far, copy from template
if (DEBUG) {
    KalturaLog::debug("This was dry-run, going to copy from template_partner_id");
    die;
} else {