def dump(shape):
    """ An equivalent of PostGIS st_dump command for shapely geometry. Returns first geom of shape or shape if not compoment element.

    :param shapely.geometry.base.BaseGeometry shape: Shapely geometry to be dumped.
    :return: First geom of shape or shape if not compoment element.


    >>> from shapely.geometry import Point, MultiPoint
    >>> multiPoint = MultiPoint([Point(4, 1)])
    >>> dump(multiPoint).wkt
    'POINT (4 1)'
    >>> dump(Point(5, 7)).wkt
    'POINT (5 7)'

    """
    if hasattr(shape, "geoms") and len(shape.geoms) == 1:
        return shape.geoms[0]
    else:
        return shape