'take screenshot.'

def screenshot(self, filename, scale=1.0, quality=100):

    result = self.server.screenshot(filename, scale, quality)
    if result:
        return result
    device_file = self.server.jsonrpc.takeScreenshot('screenshot.png', scale, quality)
    if (not device_file):
        return None
    p = self.server.adb.cmd('pull', device_file, filename)
    p.wait()
    self.server.adb.cmd('shell', 'rm', device_file).wait()
    return (filename if (p.returncode is 0) else None)
