code: def save_image(image, local_filename):
      
      r_name, __, i_name = image.rpartition('/')
      i_name, __, __ = i_name.partition(':')
      with temp_dir() as remote_tmp:
          archive = posixpath.join(remote_tmp, 'image_{0}.tar.gz'.format(i_name))
          run('docker save {0} | gzip --stdout > {1}'.format(image, archive), shell=False)
          get(archive, local_filename)
docs: Saves a Docker image as a compressed tarball. This command line client method is a suitable alternative, if the
      Remove API method is too slow.
  
      :param image: Image id or tag.
      :type image: unicode
      :param local_filename: Local file name to store the image into. If this is a directory, the image will be stored
        there as a file named ``image_<Image name>.tar.gz``.