What about defining a method which returns the desired layer based on your keyword:
def get_norm_layer(out_channels, layer_type='BatchNorm'):
    if layer_type == 'BatchNorm':
        return nn.BatchNorm2d(out_channels)
    elif layer_type == 'GroupNorm':
        return nn.GroupNorm(16, out_channels)

conv_norm_relu = nn.Sequential(
            nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1),
            get_norm_layer(out_channels, 'GroupNorm'),
            nn.ReLU(inplace=True))