def METHOD_NAME(p):
    """Test the monkeypatched `bencode.bdecode` function."""
    # Given
    value = p['value']
    allow_extra_data = p['allow_extra_data']
    expected = p['expected']
    exc_message = p['exc_message']
    raises_exc = p['raises_exc']
    # When + Then
    if raises_exc is not None:
        with pytest.raises(raises_exc, match=exc_message):
            actual = BENCODE.decode(value, allow_extra_data=allow_extra_data)
    else:
        actual = BENCODE.decode(value, allow_extra_data=allow_extra_data)
        assert expected == actual