code: def _get_key(args, kwargs, remove_callback):
      
      # Use tuples, because lists are not hashable.
      weak_args = tuple(_try_weakref(arg, remove_callback) for arg in args)
      # Use a tuple of (key, values) pairs, because dict is not hashable.
      # Sort it, so that we don't depend on the order of keys.
      weak_kwargs = tuple(sorted(
          (key, _try_weakref(value, remove_callback))
          for (key, value) in kwargs.items()))
      return weak_args, weak_kwargs
docs: Calculate the cache key, using weak references where possible.