def METHOD_NAME(a_np, rois_np, pooled_size, spatial_scale, sample_ratio, mode=b"avg"):
    """Roi align NCHW in python"""
    avg_mode = mode in (b"avg", "avg", 0)
    max_mode = mode in (b"max", "max", 1)
    assert avg_mode or max_mode, "Mode must be average or max. Please pass a valid mode."
    _, channel, height, width = a_np.shape
    if isinstance(pooled_size, int):
        pooled_size_h = pooled_size_w = pooled_size
    else:
        pooled_size_h, pooled_size_w = pooled_size
    b_np = np.zeros((rois_np.shape[0], channel, pooled_size_h, pooled_size_w), dtype=a_np.dtype)
    return roi_align_common(
        a_np,
        b_np,
        rois_np,
        channel,
        pooled_size_h,
        pooled_size_w,
        spatial_scale,
        sample_ratio,
        avg_mode,
        max_mode,
        height,
        width,
        "NCHW",
    )