'Extract data for a subtable from the form
@param form: the form
@param alias: the component alias of the subtable'

def _extract(self, form, alias=None):

    if (alias is None):
        return self.table._filter_fields(form.vars)
    else:
        subform = Storage()
        alias_length = len(alias)
        form_vars = form.vars
        for k in form_vars:
            if ((k[:4] == 'sub_') and (k[4:((4 + alias_length) + 1)] == ('%s_' % alias))):
                fn = k[((4 + alias_length) + 1):]
                subform[fn] = form_vars[k]
        return subform
