def save(url, *args, **kwargs):
device = heimdallDevice(kwargs.get('<STR_LIT>', None))<EOL>kwargs['<STR_LIT:width>'] = kwargs.get('<STR_LIT:width>', None) or device.width<EOL>kwargs['<STR_LIT>'] = kwargs.get('<STR_LIT>', None) or device.height<EOL>kwargs['<STR_LIT>'] = kwargs.get('<STR_LIT>', None) or device.user_agent<EOL>screenshot_image = screenshot(url, **kwargs)<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>image = Image.open(screenshot_image.path)<EOL>image.save(screenshot_image.path, optimize=True)<EOL><DEDENT>return screenshot_image<EOL>
Parse the options, set defaults and then fire up PhantomJS.