'Create a WorkflowStep model object and corresponding module
representing type-specific functionality from the incoming dictionary.'

def __module_from_dict(self, trans, steps, steps_by_external_id, step_dict, **kwds):

    step = model.WorkflowStep()
    step.position = step_dict['position']
    if (step_dict.get('uuid', None) and (step_dict['uuid'] != 'None')):
        step.uuid = step_dict['uuid']
    if ('label' in step_dict):
        step.label = step_dict['label']
    step_type = step_dict.get('type', None)
    if (step_type == 'subworkflow'):
        subworkflow = self.__load_subworkflow_from_step_dict(trans, step_dict)
        step_dict['subworkflow'] = subworkflow
    module = module_factory.from_dict(trans, step_dict, **kwds)
    self.__set_default_label(step, module, step_dict.get('tool_state'))
    module.save_to_step(step)
    annotation = step_dict['annotation']
    if annotation:
        annotation = sanitize_html(annotation, 'utf-8', 'text/html')
        self.add_item_annotation(trans.sa_session, trans.get_user(), step, annotation)
    step.temp_input_connections = step_dict['input_connections']
    steps.append(step)
    steps_by_external_id[step_dict['id']] = step
    if ('workflow_outputs' in step_dict):
        workflow_outputs = step_dict['workflow_outputs']
        found_output_names = set([])
        for workflow_output in workflow_outputs:
            if (not isinstance(workflow_output, dict)):
                workflow_output = {'output_name': workflow_output}
            output_name = workflow_output['output_name']
            if (output_name in found_output_names):
                raise exceptions.ObjectAttributeInvalidException(('Duplicate    workflow    outputs    with    name    [%s]    found.' % output_name))
            if (not output_name):
                raise exceptions.ObjectAttributeInvalidException('Workflow    output    with    empty    name    encountered.')
            found_output_names.add(output_name)
            uuid = workflow_output.get('uuid', None)
            label = workflow_output.get('label', None)
            m = step.create_or_update_workflow_output(output_name=output_name, uuid=uuid, label=label)
            trans.sa_session.add(m)
    return (module, step)
