def METHOD_NAME(layer):
    pad = layer.pooling_param.pad
    if pad != 0:
        pad_h = pad_w = pad
    else:
        if layer.pooling_param.pad_h != 0 and layer.pooling_param.pad_w != 0:
            pad_h = layer.pooling_param.pad_h
            pad_w = layer.pooling_param.pad_w
        else:
            pad_h = pad_w = 0
    pads = [0, 0, pad_h, pad_w, 0, 0, pad_h, pad_w]
    return pads