tiny refactor to nbconvert ansi filter

was looking at this code for another project, and was irked by what I saw
here, so just cleaned it up.