def to_obj(self, wd=False, pack=False, relpath=None):
        """Return the step as an dict that can be written to a yaml file.

        Returns:
            dict: yaml representation of the step.
        """
        obj = CommentedMap()
        if pack:
            obj['run'] = self.orig
        elif relpath is not None:
            if self.from_url:
                obj['run'] = self.run
            else:
                obj['run'] = os.path.relpath(self.run, relpath)
        elif wd:
            if self.from_url:
                obj['run'] = self.run
            else:
                obj['run'] = os.path.basename(self.run)
        else:
            obj['run'] = self.run
        obj['in'] = self.step_inputs
        obj['out'] = self.output_names
        if self.is_scattered:
            obj['scatter'] = self.scattered_inputs
            # scatter_method is optional when scattering over a single variable
            if self.scatter_method is not None:
                obj['scatterMethod'] = self.scatter_method

        return obj
Return the step as an dict that can be written to a yaml file.

        Returns:
            dict: yaml representation of the step.