def filter_by_key(data: dict) -> dict:
        """If key is not None, filter dict keeping only the key"""
        if key and data:
            try:
                return {key: _get_data_by_key(data, key)}
            except KeyError:
                return {}
        return data
If key is not None, filter dict keeping only the key
dynaconf/utils/inspect.py