code: def screenshot(self, filename=None, scale=1.0, method=None):
          
          image = None
          method = method or self._screenshot_method
          if method == 'minicap':
              try:
                  image = self._adb_minicap(scale)
              except Exception as e:
                  logger.warn("use minicap failed, fallback to screencap. error detail: %s", e)
                  self._screenshot_method = 'screencap'
                  return self.screenshot(filename=filename, scale=scale)
          elif method == 'screencap':
              image = self._adb_screencap(scale)
          else:
              raise RuntimeError("No such method(%s)" % method)
  
          if filename:
              image.save(filename)
          return image
docs: Take device screenshot
  
          Args:
              - filename(string): optional, save int filename
              - scale(float): scale size
              - method(string): one of minicap,screencap
  
          Return:
              PIL.Image