def make_pstage(block_class, num_blocks, first_stride, *, in_channels, out_channels, **kwargs):
    """
    Create a list of blocks just like those in a ResNet stage.

    Args:
        block_class (type): a subclass of ResNetBlockBase
        num_blocks (int):
        first_stride (int): the stride of the first block. The other blocks will have stride=1.
        in_channels (int): input channels of the entire stage.
        out_channels (int): output channels of **every block** in the stage.
        kwargs: other arguments passed to the constructor of every block.

    Returns:
        list[nn.Module]: a list of block module.
    """
    assert "stride" not in kwargs, "Stride of blocks in make_stage cannot be changed."
    blocks = []
    for i in range(num_blocks):
        blocks.append(
            block_class(
                in_channels=in_channels,
                out_channels=out_channels,
                stride=first_stride if i == 0 else 1,
                **kwargs,
            )
        )
        in_channels = out_channels
    return blocks