docs: def cleanup_images(self, remove_old=False, keep_tags=None, force=False, raise_on_error=False, list_only=False):
          """
          Finds all images that are neither used by any container nor another image, and removes them; by default does not
          remove repository images.
  
          :param remove_old: Also removes images that have repository names, but no `latest` tag.
          :type remove_old: bool
          :param keep_tags: List of tags to not remove.
          :type keep_tags: list[unicode | str]
          :param force: If an image is referenced by multiple repositories, Docker by default will not remove the image.
            Setting this to ``True`` forces the removal.
          :type force: bool
          :param raise_on_error: Forward errors raised by the client and cancel the process. By default only logs errors.
          :type raise_on_error: bool
          :param list_only: When set to ``True`` only lists images, but does not actually remove them.
          :type list_only: bool
          :return: List of removed image ids.
          :rtype: list[unicode | str]
          """
          used_images = set(self.inspect_container(container['Id'])['Image']
                            for container in self.containers(all=True))
          all_images = self.images(all=True)
          image_dependencies = [(image['Id'], image['ParentId'])
                                for image in all_images
                                if image['ParentId']]
          if remove_old:
              check_tags = {'latest'}
              if keep_tags:
                  check_tags.update(keep_tags)
              tag_check = tag_check_function(check_tags)
          elif remove_old:
              tag_check = tag_check_function(['latest'])
          else:
              tag_check = is_repo_image
          keep_images = {image['Id']
                         for image in all_images
                         if tag_check(image)} | used_images
          test_images = [image['Id']
                         for image in all_images
                         if image['Id'] not in keep_images]
          resolver = ImageDependentsResolver(image_dependencies)
          unused_images = [image_id
                           for image_id in test_images
                           if keep_images.isdisjoint(resolver.get_dependencies(image_id))]
          if list_only:
              return unused_images
          removed_images = []
          for iid in unused_images:
              try:
                  self.remove_image(iid, force=force)
              except:
                  exc_info = sys.exc_info()
                  if raise_on_error:
                      raise PartialResultsError(exc_info, removed_images)
              else:
                  removed_images.append(iid)
          return removed_images