Update formatter.py

Since this logic is only to prevent an empty response it should only be applied if the response is empty.