def _cleanup_json()

in src/SentinelUtilities/SentinelPortal/bookmark_helper.py [0:0]


    def _cleanup_json(self, data):
        """
            Delete keys with the value ``None`` in a dictionary, recursively.
            This alters the input so you may wish to ``copy`` the dict first.
        """
        for key, value in list(data.items()):
            if key == 'bookmark_resource_base':
                del data[key]
            elif value is None:
                del data[key]
            elif isinstance(value, dict):
                self._cleanup_json(value)

        return data