code: def _check_spacing(self, part, spacing):
      def add_if_spaces(*args):
          if spaces:
              return self.add_issue(*args)
  
      def add_not_spaces(*args):
          if not spaces:
              return self.add_issue(*args)
  
      spaces = spacing.value
      prev = self._previous_part
      if (
          prev is not None
          and prev.type == "error_leaf"
          or part.type == "error_leaf"
      ):
          return
  
      type_ = part.type
      if "\t" in spaces:
          self.add_issue(spacing, 223, "Used tab to separate tokens")
      elif type_ == "comment":
          if len(spaces) < self._config.spaces_before_comment:
              self.add_issue(
                  spacing,
                  261,
                  "At least two spaces before inline comment",
              )
      elif type_ == "newline":
          add_if_spaces(spacing, 291, "Trailing whitespace")
      elif len(spaces) > 1:
          self.add_issue(spacing, 221, "Multiple spaces used")
      else:
          if prev in _OPENING_BRACKETS:
              message = "Whitespace after '%s'" % part.value
              add_if_spaces(spacing, 201, message)
          elif part in _CLOSING_BRACKETS:
              message = "Whitespace before '%s'" % part.value
              add_if_spaces(spacing, 202, message)
          elif (
              part in (",", ";")
              or part == ":"
              and part.parent.type not in _POSSIBLE_SLICE_PARENTS
          ):
              message = "Whitespace before '%s'" % part.value
              add_if_spaces(spacing, 203, message)
          elif (
              prev == ":"
              and prev.parent.type in _POSSIBLE_SLICE_PARENTS
          ):
              pass  # TODO
          elif prev in (",", ";", ":"):
              add_not_spaces(
                  spacing, 231, "missing whitespace after '%s'"
              )
          elif part == ":":  # Is a subscript
              # TODO
              pass
          elif (
              part in ("*", "**")
              and part.parent.type not in _NON_STAR_TYPES
              or prev in ("*", "**")
              and prev.parent.type not in _NON_STAR_TYPES
          ):
              # TODO
              pass
          elif prev in _FACTOR and prev.parent.type == "factor":
              pass
          elif prev == "@" and prev.parent.type == "decorator":
              pass  # TODO should probably raise an error if there's a space here
          elif part in _NEEDS_SPACE or prev in _NEEDS_SPACE:
              if (
                  part == "="
                  and part.parent.type in ("argument", "param")
                  or prev == "="
                  and prev.parent.type in ("argument", "param")
              ):
                  if part == "=":
                      param = part.parent
                  else:
                      param = prev.parent
                  if param.type == "param" and param.annotation:
                      add_not_spaces(
                          spacing,
                          252,
                          "Expected spaces around annotation equals",
                      )
                  else:
                      add_if_spaces(
                          spacing,
                          251,
                          "Unexpected spaces around keyword / parameter equals",
                      )
              elif (
                  part in _BITWISE_OPERATOR or prev in _BITWISE_OPERATOR
              ):
                  add_not_spaces(
                      spacing,
                      227,
                      "Missing whitespace around bitwise or shift operator",
                  )
              elif part == "%" or prev == "%":
                  add_not_spaces(
                      spacing,
                      228,
                      "Missing whitespace around modulo operator",
                  )
              else:
                  message_225 = "Missing whitespace between tokens"
                  add_not_spaces(spacing, 225, message_225)
          elif type_ == "keyword" or prev.type == "keyword":
              add_not_spaces(
                  spacing, 275, "Missing whitespace around keyword"
              )
          else:
              prev_spacing = self._previous_spacing
              if (
                  prev in _ALLOW_SPACE
                  and spaces != prev_spacing.value
                  and "\n" not in self._previous_leaf.prefix
              ):
                  message = "Whitespace before operator doesn't match with whitespace after"
                  self.add_issue(spacing, 229, message)
  
              if (
                  spaces
                  and part not in _ALLOW_SPACE
                  and prev not in _ALLOW_SPACE
              ):
                  message_225 = "Missing whitespace between tokens"
                  # print('xy', spacing)
                  # self.add_issue(spacing, 225, message_225)
                  # TODO why only brackets?
                  if part in _OPENING_BRACKETS:
                      message = "Whitespace before '%s'" % part.value
                      add_if_spaces(spacing, 211, message)
  
imports: import re
  from contextlib import contextmanager
  from parso.python.errors import ErrorFinder, ErrorFinderConfig
  from parso.normalizer import Rule
  from parso.python.tree import search_ancestor, Flow, Scope
label_desc: Use image node_id 10 for calling the PEP8Normalizer obj's underlying member method code with example usage: obj._check_spacing(part, spacing) and returns: self, self