def __getitem__(self, index):
        if isinstance(index, basestring):
            l = capi.get_layer_by_name(self.ptr, index)
            if not l: raise OGRIndexError('invalid OGR Layer name given: "%s"' % index)
        elif isinstance(index, int):
            if index < 0 or index >= self.layer_count:
                raise OGRIndexError('index out of range')
            l = capi.get_layer(self._ptr, index)
        else:
            raise TypeError('Invalid index type: %s' % type(index))
        return Layer(l, self)
Allows use of the index [] operator to get a layer at the index.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/gis/gdal/datasource.py/DataSource.__getitem__