(arg)
return (lgeos.GEOSGeom_createCollection(6, subs, L), N)
ob must be either a MultiPolygon, sequence or array of sequences 
    or arrays.
ob must be either a MultiPolygon, sequence or array of sequences 
    or arrays.
ob must be either a MultiPolygon sequence or array of sequences or arrays .
def geos_multipolygon_from_polygons(arg):
    """
    ob must be either a MultiPolygon, sequence or array of sequences 
    or arrays.
    
    """
    if isinstance(arg, MultiPolygon):
        return geos_geom_from_py(arg)

    obs = getattr(arg, 'geoms', arg)
    obs = [ob for ob in obs
           if ob and not (isinstance(ob, polygon.Polygon) and ob.is_empty)]
    L = len(obs)

    # Bail immediately if we have no input points.
    if L <= 0:
        return (lgeos.GEOSGeom_createEmptyCollection(6), 3)

    exemplar = obs[0]
    try:
        N = len(exemplar[0][0])
    except TypeError:
        N = exemplar._ndim
    
    assert N == 2 or N == 3

    subs = (c_void_p * L)()

    for i, ob in enumerate(obs):
        if isinstance(ob, polygon.Polygon):
            shell = ob.exterior
            holes = ob.interiors
        else:
            shell = ob[0]
            holes = ob[1]

        geom, ndims = polygon.geos_polygon_from_py(shell, holes)
        subs[i] = cast(geom, c_void_p)

    return (lgeos.GEOSGeom_createCollection(6, subs, L), N)
def geos_multipolygon_from_polygons ( arg ) : if isinstance ( arg , MultiPolygon ) : return geos_geom_from_py ( arg ) obs = getattr ( arg , 'geoms' , arg ) obs = [ ob for ob in obs if ob and not ( isinstance ( ob , polygon . Polygon ) and ob . is_empty ) ] L = len ( obs ) # Bail immediately if we have no input points. if L <= 0 : return ( lgeos . GEOSGeom_createEmptyCollection ( 6 ) , 3 ) exemplar = obs [ 0 ] try : N = len ( exemplar [ 0 ] [ 0 ] ) except TypeError : N = exemplar . _ndim assert N == 2 or N == 3 subs = ( c_void_p * L ) ( ) for i , ob in enumerate ( obs ) : if isinstance ( ob , polygon . Polygon ) : shell = ob . exterior holes = ob . interiors else : shell = ob [ 0 ] holes = ob [ 1 ] geom , ndims = polygon . geos_polygon_from_py ( shell , holes ) subs [ i ] = cast ( geom , c_void_p ) return ( lgeos . GEOSGeom_createCollection ( 6 , subs , L ) , N )