code: def validate_method_arity(method, *needed_args):
      # type: (Callable, *str) -> None
      
      nb_needed_args = len(needed_args)
  
      # Test the number of parameters
      arg_spec = get_method_arguments(method)
      method_args = arg_spec.args
  
      try:
          # Remove the self argument when present
          if method_args[0] == "self":
              del method_args[0]
      except IndexError:
          pass
  
      nb_args = len(method_args)
  
      if arg_spec.varargs is not None:
          # Variable arguments
          if nb_args != 0:
              # Other arguments detected
              raise TypeError(
                  "When using '*args', the decorated {0} method must only "
                  "accept the 'self' argument".format(
                      get_method_description(method)
                  )
              )
      elif arg_spec.keywords is not None:
          raise TypeError("Methods using '**kwargs' are not handled")
      elif nb_args != nb_needed_args:
          # "Normal" arguments
          raise TypeError(
              "The decorated method {0} must accept exactly {1} parameters: "
              "(self, {2})".format(
                  get_method_description(method),
                  nb_needed_args + 1,
                  ", ".join(needed_args),
              )
          )
docs: Tests if the decorated method has a sufficient number of parameters.
  
      :param method: The method to be tested
      :param needed_args: The name (for description only) of the needed
                          arguments, without "self".
      :return: Nothing
      :raise TypeError: Invalid number of parameter