code: def check_no_blank_before(self, function, docstring):  # def
          
          if docstring:
              before, _, after = function.source.partition(docstring)
              blanks_before = list(map(is_blank, before.split('\n')[:-1]))
              blanks_after = list(map(is_blank, after.split('\n')[1:]))
              blanks_before_count = sum(takewhile(bool, reversed(blanks_before)))
              blanks_after_count = sum(takewhile(bool, blanks_after))
              if blanks_before_count != 0:
                  yield violations.D201(blanks_before_count)
              if not all(blanks_after) and blanks_after_count != 0:
                  yield violations.D202(blanks_after_count)
docs: D20{1,2}: No blank lines allowed around function/method docstring.
  
          There's no blank line either before or after the docstring.