def METHOD_NAME(srcs, srcfilter, cmaker, monitor):
    ctxs_mb = 0
    allctxs = []
    for src in srcs:
        sites = srcfilter.get_close_sites(src)
        if sites is None:
            continue
        for ctx in cmaker.get_ctx_iter(src, sites):
            allctxs.append(ctx)
            ctxs_mb += ctx.nbytes / TWO20  # TWO20=1MB
            if ctxs_mb > MAX_MB:
                yield {'ctxs_mb': ctxs_mb,
                       'pmap': cmaker.get_pmap(contexts.concat(allctxs))}
                allctxs.clear()
                ctxs_mb = 0
    if ctxs_mb:
        yield {'ctxs_mb': ctxs_mb,
               'pmap': cmaker.get_pmap(contexts.concat(allctxs))}