docs: def count_args(node, results):
      # type: (Node, Dict[str, Base]) -> Tuple[int, bool, bool, bool]
      """Count arguments and check for self and *args, **kwds.
  
      Return (selfish, count, star, starstar) where:
      - count is total number of args (including *args, **kwds)
      - selfish is True if the initial arg is named 'self' or 'cls'
      - star is True iff *args is found
      - starstar is True iff **kwds is found
      """
      count = 0
      selfish = False
      star = False
      starstar = False
      args = results.get('args')
      if isinstance(args, Node):
          children = args.children
      elif isinstance(args, Leaf):
          children = [args]
      else:
          children = []
      # Interpret children according to the following grammar:
      # (('*'|'**')? NAME ['=' expr] ','?)*
      skip = False
      previous_token_is_star = False
      for child in children:
          if skip:
              skip = False
          elif isinstance(child, Leaf):
              # A single '*' indicates the rest of the arguments are keyword only
              # and shouldn't be counted as a `*`.
              if child.type == token.STAR:
                  previous_token_is_star = True
              elif child.type == token.DOUBLESTAR:
                  starstar = True
              elif child.type == token.NAME:
                  if count == 0:
                      if child.value in ('self', 'cls'):
                          selfish = True
                  count += 1
                  if previous_token_is_star:
                      star = True
              elif child.type == token.EQUAL:
                  skip = True
              if child.type != token.STAR:
                  previous_token_is_star = False
      return count, selfish, star, starstar