code cleanup/refactoring
Make pydotprint support Variables and apply node

Fix gh-2108
Add return_image parameter to pydotprint