def flatten_nested_dict(nested_dict):
    """Flatten a nested dict with the keypath as key.

    Args:
        nested_dict (dict): Nested dict to flatten.

    Returns:
        dict - A dict with keypath as key and plan informations in dict form as
        value.

    Example:
        >>> flatten_nested_dict(dictionary)
        {"Arme|Mélée|Arme à une main|Dague":
            {
                'name': 'Dague', 'icon': 'MW_dagger',
                'code': 'bccmea06', 'type': 'Arme 1M'
            }
        }, ...


    """
    def items():
        """itemize dict's leaf."""
        for key, value in nested_dict.items():
            if isinstance(value, dict) and not value.get('icon', None):
                for subkey, subvalue in flatten_nested_dict(value).items():
                    yield key + "|" + subkey, subvalue
            else:
                yield key, value

    return dict(items())