old_contents: #!/usr/bin/python
  # -*- coding: utf-8 -*-
  
  from __future__ import print_function, unicode_literals
  
  """Saves full-page a screenshot of a given URL using PhantomJS over
  Privioxy->Tor"""
  
  """Copyright 2016 Sean Whalen
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
   http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License."""
  
  from argparse import ArgumentParser
  
  from selenium import webdriver
  
  __version__ = "1.0.0"
  
  args = ArgumentParser()
  args.add_argument("URL")
  args.add_argument("--dimensions", "-d", type=str, default="1024x768",
                    help="Sets the browser window size - 1024x768 by default")
  args.add_argument("--user-agent", "-u", nargs="?",
                    help="Overrides the default user-agent string")
  args.add_argument("--output", "-o", nargs="?",
                    help="Optionally set the output filename")
  
  args = args.parse_args()
  
  service_args = [
      '--proxy=localhost:8118',
      '--proxy-type=http',
      '--ignore-ssl-errors=true'
      ]
  
  url = args.URL
  if not url.lower().startswith("http://") and not url.lower().startswith("https://"):
      url = "http://{0}".format(url)
  
  dimensions = args.dimensions.lower().split("x")
  if len(dimensions) != 2:
      raise ValueError("Dimensions must be a withxheight string")
  
  dimensions = map(lambda value: int(value), dimensions)
  
  user_agent = args.user_agent
  if user_agent:
      webdriver.DesiredCapabilities.PHANTOMJS['phantomjs.page.customHeaders.User-Agent'] = user_agent
  
  filename = args.output
  if filename is None:
      filename = url.split("://")[1]
      filename = filename.split("?")[0]
      filename = filename.split("#")[0]
      filename = filename.strip("/")
      filename = filename.replace("/", "_")
  
  filename = "{0}.png".format(filename)
  
  driver = webdriver.PhantomJS(service_args=service_args)
  driver.set_window_size(dimensions[0], dimensions[1])
  driver.get(url)
  driver.save_screenshot(filename)
  
  print("Screenshot saved as {0}".format(filename))
  
new_contents: #!/usr/bin/python
  # -*- coding: utf-8 -*-
  
  """Saves full-page a screenshot of a given URL using PhantomJS over
  Privioxy->Tor"""
  
  from __future__ import print_function, unicode_literals
  
  """Copyright 2016 Sean Whalen
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
   http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License."""
  
  from argparse import ArgumentParser
  
  from selenium import webdriver
  
  __version__ = "1.0.0"
  
  args = ArgumentParser()
  args.add_argument("URL")
  args.add_argument("--dimensions", "-d", type=str, default="1024x768",
                    help="Sets the browser window size - 1024x768 by default")
  args.add_argument("--user-agent", "-u", nargs="?",
                    help="Overrides the default user-agent string")
  args.add_argument("--output", "-o", nargs="?",
                    help="Optionally set the output filename")
  
  args = args.parse_args()
  
  service_args = [
      '--proxy=localhost:8118',
      '--proxy-type=http',
      '--ignore-ssl-errors=true'
      ]
  
  url = args.URL
  if not url.lower().startswith("http://") and not url.lower().startswith("https://"):
      url = "http://{0}".format(url)
  
  dimensions = args.dimensions.lower().split("x")
  if len(dimensions) != 2:
      raise ValueError("Dimensions must be a withxheight string")
  
  dimensions = map(lambda value: int(value), dimensions)
  
  user_agent = args.user_agent
  if user_agent:
      webdriver.DesiredCapabilities.PHANTOMJS['phantomjs.page.customHeaders.User-Agent'] = user_agent
  
  filename = args.output
  if filename is None:
      filename = url.split("://")[1]
      filename = filename.split("?")[0]
      filename = filename.split("#")[0]
      filename = filename.strip("/")
      filename = filename.replace("/", "_")
  
  filename = "{0}.png".format(filename)
  
  driver = webdriver.PhantomJS(service_args=service_args)
  driver.set_window_size(dimensions[0], dimensions[1])
  driver.get(url)
  driver.save_screenshot(filename)
  
  print("Screenshot saved as {0}".format(filename))
  
subject: Fix docstring