code: def syncImage(img, current, session):
      
      def _img_str(i):
          return "%s - %s" % (i.type, i.description)
  
      for db_img in current.images:
          img_info = (img.type, img.md5, img.size)
          db_img_info = (db_img.type, db_img.md5, db_img.size)
  
          if db_img_info == img_info:
              img = None
              break
          elif (db_img.type == img.type and
                  db_img.description == img.description):
  
              if img.md5 != db_img.md5:
                  # Update image
                  current.images.remove(db_img)
                  current.images.append(img)
                  session.add(current)
                  pout(Fg.green("Updating image") + ": " + _img_str(img))
              img = None
              break
  
      if img:
          # Add image
          current.images.append(img)
          session.add(current)
          pout(Fg.green("Adding image") + ": " + _img_str(img))
docs: Add or updated the Image.