def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
<EOL>raw = clean_lines.lines_without_raw_strings<EOL>line = raw[linenum]<EOL>if (IsBlankLine(line) and<EOL>not nesting_state.InNamespaceBody() and<EOL>not nesting_state.InExternC()):<EOL><INDENT>elided = clean_lines.elided<EOL>prev_line = elided[linenum - <NUM_LIT:1>]<EOL>prevbrace = prev_line.rfind('<STR_LIT:{>')<EOL>if prevbrace != -<NUM_LIT:1> and prev_line[prevbrace:].find('<STR_LIT:}>') == -<NUM_LIT:1>:<EOL><INDENT>exception = False<EOL>if Match(r'<STR_LIT>', prev_line):  <EOL><INDENT>search_position = linenum-<NUM_LIT:2><EOL>while (search_position >= <NUM_LIT:0><EOL>and Match(r'<STR_LIT>', elided[search_position])):<EOL><INDENT>search_position -= <NUM_LIT:1><EOL><DEDENT>exception = (search_position >= <NUM_LIT:0><EOL>and elided[search_position][:<NUM_LIT:5>] == '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>exception = (Match(r'<STR_LIT>',<EOL>prev_line)<EOL>or Match(r'<STR_LIT>', prev_line))<EOL><DEDENT>if not exception:<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:2>,<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT>if linenum + <NUM_LIT:1> < clean_lines.NumLines():<EOL><INDENT>next_line = raw[linenum + <NUM_LIT:1>]<EOL>if (next_line<EOL>and Match(r'<STR_LIT>', next_line)<EOL>and next_line.find('<STR_LIT>') == -<NUM_LIT:1>):<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:3>,<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT>matched = Match(r'<STR_LIT>', prev_line)<EOL>if matched:<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:3>,<EOL>'<STR_LIT>' % matched.group(<NUM_LIT:1>))<EOL><DEDENT><DEDENT>next_line_start = <NUM_LIT:0><EOL>if linenum + <NUM_LIT:1> < clean_lines.NumLines():<EOL><INDENT>next_line = raw[linenum + <NUM_LIT:1>]<EOL>next_line_start = len(next_line) - len(next_line.lstrip())<EOL><DEDENT>CheckComment(line, filename, linenum, next_line_start, error)<EOL>line = clean_lines.elided[linenum]<EOL>if Search(r'<STR_LIT>', line) and not Search(r'<STR_LIT>', line):<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:5>,<EOL>'<STR_LIT>')<EOL><DEDENT>if (Search(r'<STR_LIT>', line) or<EOL>Search(r'<STR_LIT>', line)):<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:2>,<EOL>'<STR_LIT>')<EOL><DEDENT>
Checks for the correctness of various spacing issues in the code.

    Things we check for: spaces around operators, spaces after
    if/for/while/switch, no spaces around parens in function calls, two
    spaces between code and comment, don't start a block with a blank
    line, don't end a function with a blank line, don't add a blank line
    after public/protected/private, don't have too many blank lines in a row.

    Args:
      filename: The name of the current file.
      clean_lines: A CleansedLines instance containing the file.
      linenum: The number of the line to check.
      nesting_state: A NestingState instance which maintains information about
                     the current stack of nested blocks being parsed.
      error: The function to call with any errors found.