def pop(self, *args):
        """Remove specified key, return corresponding value.

        Receives one or two arguments.

        If one it must be a key:

            i) If key exists, remove key/value item and
            return value (value is also removed from the
            flat values list);
            ii) If key doesn't exist raises KeyError;

        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
            returned;

        Extends dict.pop.
        """
        ### 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.pop method with
        ### the received arguments; the parameters used
        ### ensure that the signature works exactly like
        ### dict.pop, raising errors when errors need to
        ### be raised;
        value = super().pop(*args)

        ### if the key exists, remove corresponding
        ### value(s) depending on whether the value is
        ### a mapping or not

        if key_exists:

            ## remove the value from the flat_values
            ## list if it is not a mapping
            if not isinstance(value, Mapping):
                self._bound_remove(value)

            ## or remove all its nested values from the
            ## list if the value is a mapping

            else:

                # get generator with all nested values
                nested_values = flatten_mapping_values(value)

                # remove one by one from the flat_values
                # list
                for nested_value in nested_values:
                    self._bound_remove(nested_value)

        ### finally return the value
        return value
Remove specified key, return corresponding value.

        Receives one or two arguments.

        If one it must be a key:

            i) If key exists, remove key/value item and
            return value (value is also removed from the
            flat values list);
            ii) If key doesn't exist raises KeyError;

        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
            returned;

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