def screenshot(self, png_filename=None, format='<STR_LIT>'):
value = self.http.get('<STR_LIT>').value<EOL>raw_value = base64.b64decode(value)<EOL>png_header = b"<STR_LIT>"<EOL>if not raw_value.startswith(png_header) and png_filename:<EOL><INDENT>raise WDAError(-<NUM_LIT:1>, "<STR_LIT>")<EOL><DEDENT>if png_filename:<EOL><INDENT>with open(png_filename, '<STR_LIT:wb>') as f:<EOL><INDENT>f.write(raw_value)<EOL><DEDENT><DEDENT>if format == '<STR_LIT>':<EOL><INDENT>return raw_value<EOL><DEDENT>elif format == '<STR_LIT>':<EOL><INDENT>from PIL import Image<EOL>buff = io.BytesIO(raw_value)<EOL>return Image.open(buff)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>
Screenshot with PNG format

Args:
    png_filename(string): optional, save file name
    format(string): return format, pillow or raw(default)
Returns:
    raw data or PIL.Image

Raises:
    WDAError