def setdefault(self, key: StashKey[T], default: T) -> T:
        """Return the value of key if already set, otherwise set the value
        of key to default and return default."""
        try:
            return self[key]
        except KeyError:
            self[key] = default
            return default
Return the value of key if already set, otherwise set the value
        of key to default and return default.
src/_pytest/stash.py