Given $form, how to programmatically generate its corresponding $form_state? The media_mover module contains this function, which builds a form and pre-populates default values:

/* step 1 */ $form = media_mover_api_configuration_base_form($configuration); 


It also contains this function, which submits the form:

/* step 2 */ function media_mover_api_add_config_form_submit($form, &amp;$form_state)


I would like to programmatically generate the form (step 1), and then programmatically submit the form (step 2).
Step 1 is not a problem; I am able to generate $form.  For step 2, I need $form_state.

Given $form, is there a way to programmatically generate its corresponding $form_state?  I am using Drupal 6.

This is a more detailed explanation of what I am trying to accomplish.
I am able to programmatically fill out and submit a particular form by laboriously setting all the field values in $form_state['values'], and then calling media_mover_api_add_config_form_submit($form, &amp;$form_state);

However, the process would be  much simpler if I could instead use this function, which converts a $configuration object into $form, and does all the heavy lifting:

$form = media_mover_api_configuration_base_form($configuration);


This function enters a default value into each form field. 
The only missing step, then, is to copy all these default field values from $form to $form_state['values']. I am wondering whether there is a function to do this.  Or is there a way to loop through all the fields in $form and extract the field-name and default value?
Here is what I did to fill $form_state['values'] with the default values from $form:

function mymodule_get_form_state($form){
  $values = array();
  _mymodule_form_get_values($form, &amp;$values);
  $form_state = array();
  $form_state['values'] = $values;
  return ($form_state);
}

function _mymodule_form_get_values($element, &amp;$values) {
  foreach (element_children($element) as $key) {
    if (isset($element[$key]) &amp;&amp; $element[$key]) {
      if (isset($element[$key]['#default_value']) &amp;&amp; $element[$key]['#default_value']) {
        $values[$key] = $element[$key]['#default_value'];
      } else {
        // Recurse through all children elements.
        _mymodule_form_get_values($element[$key], &amp;$values);
      }
    }
  }
}