'Walk over the supplid step dictionaries and return them in a way designed
to preserve step order when possible.'

def __walk_step_dicts(self, data):

    supplied_steps = data['steps']
    step_indices = supplied_steps.keys()
    try:
        step_indices = sorted(step_indices, key=int)
    except ValueError:
        pass
    discovered_labels = set()
    discovered_uuids = set()
    discovered_output_labels = set()
    discovered_output_uuids = set()
    for step_index in step_indices:
        step_dict = supplied_steps[step_index]
        uuid = step_dict.get('uuid', None)
        if (uuid and (uuid != 'None')):
            if (uuid in discovered_uuids):
                raise exceptions.DuplicatedIdentifierException('Duplicate    step    UUID    in    request.')
            discovered_uuids.add(uuid)
        label = step_dict.get('label', None)
        if label:
            if (label in discovered_labels):
                raise exceptions.DuplicatedIdentifierException('Duplicated    step    label    in    request.')
            discovered_labels.add(label)
        if ('workflow_outputs' in step_dict):
            outputs = step_dict['workflow_outputs']
            if isinstance(outputs, dict):
                for output_name in outputs:
                    output_dict = outputs[output_name]
                    output_label = output_dict.get('label', None)
                    if output_label:
                        if (label in discovered_output_labels):
                            raise exceptions.DuplicatedIdentifierException('Duplicated    workflow    output    label    in    request.')
                        discovered_output_labels.add(label)
                    output_uuid = step_dict.get('output_uuid', None)
                    if output_uuid:
                        if (output_uuid in discovered_output_uuids):
                            raise exceptions.DuplicatedIdentifierException('Duplicate    workflow    output    UUID    in    request.')
                        discovered_output_uuids.add(uuid)
        (yield step_dict)
