<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sky_to_image(shape_list, header):
 """Converts a `ShapeList` into shapes with coordinates in image coordinates Parameters shape_list : `pyregion.ShapeList` The ShapeList to convert header : `~astropy.io.fits.Header` Specifies what WCS transformations to use. Yields ------- shape, comment : Shape, str Shape with image coordinates and the associated comment Note ---- The comments in the original `ShapeList` are unaltered """


        for shape, comment in shape_list:
            if isinstance(shape, Shape) and \
                    (shape.coord_format not in image_like_coordformats):

                new_coords = convert_to_imagecoord(shape, header)

                l1n = copy.copy(shape)

                l1n.coord_list = new_coords
                l1n.coord_format = "image"
                yield l1n, comment

            elif isinstance(shape, Shape) and shape.coord_format == "physical":

                if header is None:
                    raise RuntimeError("Physical coordinate is not known.")

                new_coordlist = convert_physical_to_imagecoord(shape, header)

                l1n = copy.copy(shape)

                l1n.coord_list = new_coordlist
                l1n.coord_format = "image"
                yield l1n, comment

            else:
                yield shape, comment