@check_for(Class)<EOL><INDENT>def check_blank_before_after_class(self, class_, docstring):<DEDENT>
<EOL>if docstring:<EOL><INDENT>before, _, after = class_.source.partition(docstring)<EOL>blanks_before = list(map(is_blank, before.split('<STR_LIT:\n>')[:-<NUM_LIT:1>]))<EOL>blanks_after = list(map(is_blank, after.split('<STR_LIT:\n>')[<NUM_LIT:1>:]))<EOL>blanks_before_count = sum(takewhile(bool, reversed(blanks_before)))<EOL>blanks_after_count = sum(takewhile(bool, blanks_after))<EOL>if blanks_before_count != <NUM_LIT:0>:<EOL><INDENT>yield violations.D211(blanks_before_count)<EOL><DEDENT>if blanks_before_count != <NUM_LIT:1>:<EOL><INDENT>yield violations.D203(blanks_before_count)<EOL><DEDENT>if not all(blanks_after) and blanks_after_count != <NUM_LIT:1>:<EOL><INDENT>yield violations.D204(blanks_after_count)<EOL><DEDENT><DEDENT>
D20{3,4}: Class docstring should have 1 blank line around them.

        Insert a blank line before and after all docstrings (one-line or
        multi-line) that document a class -- generally speaking, the class's
        methods are separated from each other by a single blank line, and the
        docstring needs to be offset from the first method by a blank line;
        for symmetry, put a blank line between the class header and the
        docstring.