original_string: public function is_block_present($blockname) {
          if (empty($this->blockinstances)) {
              return false;
          }
  
          $requiredbythemeblocks = $this->get_required_by_theme_block_types();
          foreach ($this->blockinstances as $region) {
              foreach ($region as $instance) {
                  if (empty($instance->instance->blockname)) {
                      continue;
                  }
                  if ($instance->instance->blockname == $blockname) {
                      if ($instance->instance->requiredbytheme) {
                          if (!in_array($blockname, $requiredbythemeblocks)) {
                              continue;
                          }
                      }
                      return true;
                  }
              }
          }
          return false;
      }
code: public function is_block_present($blockname) {
          if (empty($this->blockinstances)) {
              return false;
          }
  
          $requiredbythemeblocks = $this->get_required_by_theme_block_types();
          foreach ($this->blockinstances as $region) {
              foreach ($region as $instance) {
                  if (empty($instance->instance->blockname)) {
                      continue;
                  }
                  if ($instance->instance->blockname == $blockname) {
                      if ($instance->instance->requiredbytheme) {
                          if (!in_array($blockname, $requiredbythemeblocks)) {
                              continue;
                          }
                      }
                      return true;
                  }
              }
          }
          return false;
      }
code_tokens: public function is_block_present ( $ blockname ) { if ( empty ( $ this -> blockinstances ) ) { return false ; } $ requiredbythemeblocks = $ this -> get_required_by_theme_block_types ( ) ; foreach ( $ this -> blockinstances as $ region ) { foreach ( $ region as $ instance ) { if ( empty ( $ instance -> instance -> blockname ) ) { continue ; } if ( $ instance -> instance -> blockname == $ blockname ) { if ( $ instance -> instance -> requiredbytheme ) { if ( ! in_array ( $ blockname , $ requiredbythemeblocks ) ) { continue ; } } return true ; } } } return false ; }
docstring: Given a block name, find out of any of them are currently present in the page
  
  @param string $blockname - the basic name of a block (eg "navigation")
  @return boolean - is there one of these blocks in the current page?
docstring_tokens: Given a block name find out of any of them are currently present in the page