Vertical Tabs in render arrays without the Form API in Drupal 7

This is a quick reminder to myself so I don't forget in future. Using Vertical Tabs within forms is fairly easy as it's part of the form API. It was a little harder for me to work out how to do it without using the Form API and using only a render array. The example below shows how to split up content using Vertical Tabs from within a render array:

<?php

function example_vertical_tab_render_array() {
  return array(
   
'example' => array(
     
'fieldset1' => array(
       
'#type' => 'fieldset',
       
'#title' => t('Test'),
       
'#attributes' => array('class' => array('collapsible', 'collapsed'), 'id' => 'fieldset1'),
       
'content' => array(
         
'#markup' => t('Test1'),
        ),
      ),
     
'fieldset2' => array(
       
'#type' => 'fieldset',
       
'#title' => t('Test'),
       
'#attributes' => array('class' => array('collapsible', 'collapsed'), 'id' => 'fieldset2'),
       
'content' => array(
         
'#markup' => t('Test2'),
        ),
      ),
     
'#attached' => array(
       
'js' => array('misc/collapse.js', 'misc/form.js'),
       
'library' => array(array('system', 'drupal.vertical-tabs')),
      ),
     
'#prefix' => '<div class="vertical-tabs-panes">',
     
'#suffix' => '</div>',
    ),
  );
}
?>