code: def _format_argument_list(allowed_args: list[str]) -> str:
      """
      Format allowed arguments list for use in the warning message of
      `deprecate_nonkeyword_arguments`.
      """  # noqa: D205
      if "self" in allowed_args:
          allowed_args.remove("self")
      if not allowed_args:
          return ""
      elif len(allowed_args) == 1:
          return f" except for {allowed_args[0]!r}"
      else:
          last = allowed_args[-1]
          args = ", ".join([f"{x!r}" for x in allowed_args[:-1]])
          return f" except for {args} and {last!r}"
  
file_path: polars/py-polars/polars/utils/deprecation.py
imports: from __future__ import annotations
  import inspect
  import warnings
  from functools import wraps
  from typing import TYPE_CHECKING, Callable, TypeVar
  from polars.utils.various import find_stacklevel
label_desc: Use image node_id 7 for calling a global function with example usage: _format_argument_list(allowed_args) and returns: str, str, allowed_args, str, args, str, last