def setdefault(self, *args):
        """Return value associated with given key.

        If the key doesn't exist, set the default value
        in the key and return the value. The flat_values
        list is updated accordingly. The default value
        mentioned is defined as explained below.

        The method receives one or two arguments:

        If one it must be a key:

            i) If key exists, return corresponding value;
            ii) If key doesn't exist, assign None as the
            value for the key and it

        If there are two arguments, one is the key and the
        other is a default value.

            iii) If key exists, same as (i);
            iv) If key doesn't exist, the default value is
                assigned to the key and returned

        Extends dict.setdefault.
        """
        ### retrieve key from first argument
        key = args[0]

        ### store boolean indicating whether the key
        ### exists in the dictionary
        key_exists = key in self

        ### execute the builtin dict.setdefault method with
        ### the received arguments; the parameters used
        ### ensure that the signature works exactly like
        ### dict.setdefault, raising errors when errors
        ### need to be raised;
        value = super().setdefault(*args)

        ### if the key doesn't exist, since the default
        ### value will be added, add the value(s) to the
        ### flat_values too, depending on whether the
        ### default value is a mapping or not

        if not key_exists:

            ## store the value in the flat value list
            ## if it is not a mapping

            if not isinstance(value, Mapping):
                self._bound_append(value)

            ## otherwise store all nested values if the
            ## value is a mapping

            else:

                nested_values = flatten_mapping_values(value)
                self._bound_extend(nested_values)

        ### finally return the value
        return value
Return value associated with given key.

        If the key doesn't exist, set the default value
        in the key and return the value. The flat_values
        list is updated accordingly. The default value
        mentioned is defined as explained below.

        The method receives one or two arguments:

        If one it must be a key:

            i) If key exists, return corresponding value;
            ii) If key doesn't exist, assign None as the
            value for the key and it

        If there are two arguments, one is the key and the
        other is a default value.

            iii) If key exists, same as (i);
            iv) If key doesn't exist, the default value is
                assigned to the key and returned

        Extends dict.setdefault.
        
nodezator/ourstdlibs/collections/fldict/main.py