Get Block ID from Block Type

cga_utilities.php
<?php
/**
 * Utility function to get Block ID for a certain block type
 */
function cga_import_get_id_of_block_type($block_type) {
  $bids = array();

  $query = new EntityFieldQuery();
  $result = $query
   ->entityCondition('entity_type', 'bean')
   ->entityCondition('bundle', $block_type)
   ->execute();
  //get bean ids
  if (isset($result['bean'])) {
   $bids = array_keys($result['bean']);
  }
  return array_shift($bids);
}