def METHOD_NAME(x, config):
    # handle the exteme case where the input has the dimension 1 by 1 and is not reductible
    # we will just change the reduction layer to identity layer
    # such situation is very likely to appear though
    dim = K.int_shape(x)
    if dim[1] == 1 or dim[2] == 1:
        print("WARNING: One or more dimensions of the input of the reduction layer is 1. It cannot be further reduced. A identity layer will be used instead.")
        return x
    parameters = {
        'reduction_type':   "max_pooling",
        'pool_size':        2,
        'stride':           None,
    }
    if 'reduction_type' in config:
        parameters['reduction_type'] = config['reduction_type']
    if 'pool_size' in config:
        parameters['pool_size'] = int(config['pool_size'])
    if 'stride' in config:
        parameters['stride'] = int(config['stride'])
    if parameters['reduction_type'] == 'max_pooling':
        result = MaxPooling2D(
            pool_size=parameters['pool_size'],
            strides=parameters['stride']
        )(x)
    elif parameters['reduction_type'] == 'avg_pooling':
        result = AveragePooling2D(
            pool_size=parameters['pool_size'],
            strides=parameters['stride']
        )(x)
    return result