Fix issue with formatting random objects that don't have the '__dict__' attribute