How to change html of CAPTCHA module in another module? I add captcha field to form in this way

$form['captcha'] = array(
    '#type' =&gt; 'captcha',
    '#title' =&gt; 'Simple title',
    '#captcha_type' =&gt; 'captcha/Math',
    '#description' =&gt; 'Please solve it'
);


This element will be rendered as 

&lt;fieldset class="captcha form-wrapper"&gt;&lt;legend&gt;&lt;span class="fieldset-legend"&gt;CAPTCHA&lt;/span&gt;&lt;/legend&gt;&lt;div class="fieldset-wrapper"&gt;&lt;div class="fieldset-description"&gt;Please solve it&lt;/div&gt;&lt;input type="hidden" name="captcha_sid" value="102"&gt;
&lt;input type="hidden" name="captcha_token" value="bf6179f1c98e4291e1bb2e11c733d991"&gt;
&lt;div class="form-item form-type-textfield form-item-captcha-response"&gt;
  &lt;label for="edit-captcha-response"&gt;Math question &lt;span class="form-required" title="Обов'язкове поле"&gt;*&lt;/span&gt;&lt;/label&gt;
 &lt;span class="field-prefix"&gt;20 + 0 = &lt;/span&gt; &lt;input type="text" id="edit-captcha-response" name="captcha_response" value="" size="4" maxlength="2" class="form-text required" autocomplete="off"&gt;
&lt;div class="description"&gt;Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/fieldset&gt;


How to change this html template ?
I guess you could override theme_captcha. here is the code

function bartik_captcha($variables){
  $element = $variables['element'];
  $output='&lt;h2&gt;'.$element['#title'].'&lt;/h2&gt;';
  $output.= drupal_render_children($element);
  return $output;
}