def equal_args(*args, **kwargs):
  """A memoized key factory that compares the equality (`==`) of a stable sort of the parameters."""
  key = args
  if kwargs:
    key += _kwargs_separator + tuple(sorted(kwargs.items()))
  return key