code: def to_obj(self, wd=False, pack=False, relpath=None):
          self._closed()
          obj = CommentedMap()
          obj['cwlVersion'] = 'v1.0'
          obj['class'] = 'Workflow'
          try:
              obj['doc'] = self.documentation
          except (AttributeError, ValueError):
              pass
          try:
              obj['label'] = self.label
          except (AttributeError, ValueError):
              pass
          if self._has_requirements():
              obj['requirements'] = []
          if self.has_workflow_step:
              obj['requirements'].append(
                  {'class': 'SubworkflowFeatureRequirement'})
          if self.has_scatter_requirement:
              obj['requirements'].append({'class': 'ScatterFeatureRequirement'})
          if self.has_multiple_inputs:
              obj['requirements'].append(
                  {'class': 'MultipleInputFeatureRequirement'})
          obj['inputs'] = self.wf_inputs
          obj['outputs'] = self.wf_outputs
          steps_obj = CommentedMap()
          for key in self.wf_steps:
              steps_obj[key] = self.wf_steps[key].to_obj(relpath=relpath,
                                                         pack=pack,
                                                         wd=wd)
          obj['steps'] = steps_obj
          return obj