def METHOD_NAME(self):
    if not os.path.exists(OUTPUT_DIR):
        os.makedirs(OUTPUT_DIR)
    nodes = []
    body = '\n'.join(self.content)
    tf = tempfile.NamedTemporaryFile(delete=False)
    tf.write(body.encode('utf8'))
    tf.flush()
    # make a filename
    filename_template = self.options.pop('filename', '{checksum}.png')
    filename = filename_template.format({
        'checksum': hashlib.sha256(body.encode('utf-8')).hexdigest()[0:12],
    })
    alt = self.options.get('alt', 'ditaa diagram')
    classes = self.options.pop('class', ['ditaa'])
    cmdline_opts = self.options.pop('cmdline', '').split(' ')
    cmdline = [
        'ditaa',
        tf.name,
        os.path.join(OUTPUT_DIR, filename),
        '--overwrite',
        '--encoding', 'utf8',
    ] + cmdline_opts
    try:
        p = subprocess.METHOD_NAME(cmdline, capture_output=True)
    except Exception as exc:
        error = self.state_machine.reporter.error(
            'Failed to run ditaa: %s' % (exc, ),
            literal_block(self.block_text, self.block_text),
            line=self.lineno)
        nodes.append(error)
    else:
        if p.returncode == 0:
            url = OUTPUT_URL_PATH + '/' + filename
            imgnode = image(uri=url, classes=classes, alt=alt)
            nodes.append(imgnode)
        else:
            error = self.state_machine.reporter.error(
                'Error in "%s" directive: %s' % (self.name, p.stderr),
                literal_block(self.block_text, self.block_text),
                line=self.lineno)
            nodes.append(error)
    finally:
        os.unlink(tf.name)
    self.state.document.settings.record_dependencies.add("####MAGIC####CONFIG:DITAA_OUTPUT_URL_PATH")
    return nodes