code: def set_output(self):
          
          if not self.output:
              return open(devnull, 'w')
          
          # Get the output file path
          output_dir = dirname(self.output)
          
          # Make the path exists
          if not isdir(output_dir):
              try:
                  makedirs(output_dir)
              except Exception as e:
                  self.die('Failed to create output directory "{}": {}'.format(output_dir, str(e)))
          return open(self.output, 'a')
docs: Set the output for the service command.