code: def image_to_file(self, path):
          
          _LOGGER.debug("Writing image from %s to %s", self.name, path)
          response = self._cached_image
          if response.status_code == 200:
              with open(path, 'wb') as imgfile:
                  copyfileobj(response.raw, imgfile)
          else:
              _LOGGER.error("Cannot write image to file, response %s",
                            response.status_code,
                            exc_info=True)
docs: Write image to file.
  
          :param path: Path to write file