'Verify useful for debugging! When a test does NOT pass we can take a
screenshot of the current virtual X environment and "attach" it to the error
log.
Note: This requires Xvfb to be started with -fbdir'

def get_screenshot(self):

    output_fname = None
    if self.is_running():
        for xwd_file in (self.SCREEN_XWD_FILE_0,):
            temp_file = tempfile.mkstemp(prefix='xvfb-screenshot-')[1]
            shutil.copy(xwd_file, temp_file)
            target_jpeg = (temp_file + '.jpeg')
            convert_cmd = ('convert    %s    %s' % (temp_file, target_jpeg))
            (_, _) = commands.getstatusoutput(convert_cmd)
            os.unlink(temp_file)
            output_fname = target_jpeg
    return output_fname
