Implements seam carving in python