I'm not sure if that can happen or what if would mean but if the dict at `legend[_aes_name]` is empty, it will be deleted because `if not legend[_aes_name]:` will take the `True` path in the if condition.