code: public function getBlockName(Mage_Core_Block_Abstract $block)
      {
          $blockName = $block->getParentBlock() ?
              "{$block->getParentBlock()->getNameInLayout()}_{$block->getNameInLayout()}" :
              "{$block->getNameInLayout()}";
  
          if ($block->getBlockAlias()) {
              $blockName .= "_{$block->getBlockAlias()}";
          }
  
          return $blockName;
      }
docs: Formats the blockname used in the observer::onBlockToHtml method
  
  @param Mage_Core_Block_Abstract $block
  @return string