def snapshot(self, filename=None, quality=10, max_size=None):
        """Take snapshot.

        Args:
            filename: save screenshot to filename
            quality: The image quality, integer in range [1, 99]
            max_size: the maximum size of the picture, e.g 1200

        Returns:
            Screen snapshot's cv2 object.
        """
        data = self._neo_wda_screenshot()
        # Output cv2 object.
        try:
            screen = aircv.utils.string_2_img(data)
        except:
            # May be black/locked screen or other reason, print exc for debugging.
            traceback.print_exc()
            return None

        # Save as file if needed.
        if filename:
            aircv.imwrite(filename, screen, quality, max_size=max_size)

        return screen
Take snapshot.

        Args:
            filename: save screenshot to filename
            quality: The image quality, integer in range [1, 99]
            max_size: the maximum size of the picture, e.g 1200

        Returns:
            Screen snapshot's cv2 object.
        
airtest/core/ios/ios.py