def getRasterBands(datasource,bandids,bandMatchFunc):
    """
    datasource: the loading meta data of  raster datasource
    bandIds: a list of band ids, each member of list can be a id or list of ids
    batchMatchFunc: the function to check whether the band match the specified bandid
    return the ranster band with same structure as bandIds
    """
    bands = []
    for bandid in bandids:
        if isinstance(bandid,list):
            bands.append(getRasterBands(datasource,bandid,bandMatchFunc))
        else:
            matchedBand = None
            for band in datasource["bands"]:
                if bandMatchFunc(datasource,band,bandid):
                    matchedBand = band
                    break
            bands.append(matchedBand)
    return bands