def _traverse(self, name, create_missing=False, action=None, value=NO_DEFAULT):
        """Traverse to the item specified by ``name``.

        To create missing items on the way to the ``name``d item, pass
        ``create_missing=True``. This will insert an item for each
        missing segment in ``name``. The type and value of item that
        will be inserted for a missing segment depends on the *next*
        segment. If a ``default`` value is passed, the ``name``d item
        will be set to this value; otherwise, a default default will
        be used. See :meth:`_create_segment` for more info.

        """
        obj = self
        segments = self._parse_path(name)

        for segment, next_segment in zip(segments, segments[1:] + [None]):
            last = next_segment is None

            if create_missing:
                self._create_segment(obj, segment, next_segment)

            try:
                next_obj = obj[segment]
            except IndexError:
                raise KeyError(segment)

            if not last:
                obj = next_obj
            else:
                if action:
                    value = action(obj, segment)
                elif value is not NO_DEFAULT:
                    obj[segment] = value
                else:
                    value = obj[segment]

        return value
def _traverse ( self , name , create_missing = False , action = None , value = NO_DEFAULT ) : obj = self segments = self . _parse_path ( name ) for segment , next_segment in zip ( segments , segments [ 1 : ] + [ None ] ) : last = next_segment is None if create_missing : self . _create_segment ( obj , segment , next_segment ) try : next_obj = obj [ segment ] except IndexError : raise KeyError ( segment ) if not last : obj = next_obj else : if action : value = action ( obj , segment ) elif value is not NO_DEFAULT : obj [ segment ] = value else : value = obj [ segment ] return value
Traverse to the item specified by ``name``.

        To create missing items on the way to the ``name``d item, pass
        ``create_missing=True``. This will insert an item for each
        missing segment in ``name``. The type and value of item that
        will be inserted for a missing segment depends on the *next*
        segment. If a ``default`` value is passed, the ``name``d item
        will be set to this value; otherwise, a default default will
        be used. See :meth:`_create_segment` for more info.