Converts a list of regions into a `regions.ShapeList` object.

    Parameters
    ----------
    region_list: python list
        Lists of `regions.Region` objects
    format_type: str ('DS9' or 'CRTF')
        The format type of the Shape object. Default is 'DS9'.
    coordinate_system: str
        The astropy coordinate system frame in which all the coordinates present
        in the `region_list` will be converted. Default is 'fk5'.

    Returns
    -------
    shape_list: `regions.ShapeList` object
        list of `regions.Shape` objects.

def to_shape_list(region_list, coordinate_system='fk5'):
    """
    Converts a list of regions into a `regions.ShapeList` object.

    Parameters
    ----------
    region_list: python list
        Lists of `regions.Region` objects
    format_type: str ('DS9' or 'CRTF')
        The format type of the Shape object. Default is 'DS9'.
    coordinate_system: str
        The astropy coordinate system frame in which all the coordinates present
        in the `region_list` will be converted. Default is 'fk5'.

    Returns
    -------
    shape_list: `regions.ShapeList` object
        list of `regions.Shape` objects.
    """

    shape_list = ShapeList()

    for region in region_list:

        coord = []
        if isinstance(region, SkyRegion):
            reg_type = region.__class__.__name__[:-9].lower()
        else:
            reg_type = region.__class__.__name__[:-11].lower()

        for val in regions_attributes[reg_type]:
            coord.append(getattr(region, val))

        if reg_type == 'polygon':
            coord = [x for x in region.vertices]

        if coordinate_system:
            coordsys = coordinate_system
        else:
            if isinstance(region, SkyRegion):
                coordsys = coord[0].name
            else:
                coordsys = 'image'

        frame = coordinates.frame_transform_graph.lookup_name(coordsys)

        new_coord = []
        for val in coord:
            if isinstance(val, Angle) or isinstance(val, u.Quantity) or isinstance(val, numbers.Number):
                new_coord.append(val)
            elif isinstance(val, PixCoord):
                new_coord.append(u.Quantity(val.x, u.dimensionless_unscaled))
                new_coord.append(u.Quantity(val.y, u.dimensionless_unscaled))
            else:
                new_coord.append(Angle(val.transform_to(frame).spherical.lon))
                new_coord.append(Angle(val.transform_to(frame).spherical.lat))

        meta = dict(region.meta)
        meta.update(region.visual)

        if reg_type == 'text':
            meta['text'] = meta.get('text', meta.pop('label', ''))

        include = region.meta.pop('include', True)

        shape_list.append(Shape(coordsys, reg_type, new_coord, meta, False,
                                include))

    return shape_list