def METHOD_NAME(self, docname, moderator):
    session = Session()
    subquery = session.query(
        Comment.node_id,
        func.count('*').label('comment_count')).group_by(
        Comment.node_id).subquery()
    nodes = session.query(Node.id, subquery.c.comment_count).outerjoin(
        (subquery, Node.id == subquery.c.node_id)).filter(
        Node.document == docname)
    session.close()
    session.commit()
    return dict([(k, v or 0) for k, v in nodes])