def get(dataset, layer, feature=None):
    """
    get the targer layer, or feature from a data set

    Parameters
    ----------
    dataset: ogr.DataSource
        vector dataset
    layer: int
        layer number
    feature: int or None (optional)
        feature number in layer 
    """

    layer = dataset.GetLayer(layer)
    if feature is None or layer is None:
        return layer
    return layer.GetFeature(feature)