code: def screenshot(self, filename=None):
          
          tmpfile = tempfile.mktemp(prefix='atx-screencap-', suffix='.tiff')
          try:
              idevice("screenshot", "--udid", self.udid, tmpfile)
          except subprocess.CalledProcessError as e:
              sys.exit(e.message)
  
          try:
              image = Image.open(tmpfile)
              image.load()
              if filename:
                  image.save(filename)
              return image
          finally:
              if os.path.exists(tmpfile):
                  os.unlink(tmpfile)
docs: Return:
              PIL.Image
              
          Raises:
              EnvironmentError