style: renamed variables to avoid re-assignment of built-ins
bugfix: fixed undefined values by importing appropriate modules

- `import urlparse`
- `from xml.sax.saxutils import escape`