<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def do_work_spec(self, args):
        '''dump the contents of an existing work spec'''
        work_spec_name = self._get_work_spec_name(args)
        spec = self.task_master.get_work_spec(work_spec_name)
        if args.json:
            self.stdout.write(json.dumps(spec, indent=4, sort_keys=True) +
                              '\n')
        else:
            yaml.safe_dump(spec, self.stdout)