I have an array `ar = [2,2,2,1,1,2,2,3,3,3,3]`.
For this array, I want to find the lengths of consecutive same numbers like:

```
 values: 2, 1, 2, 3
lengths: 3, 2, 2, 4

```

In `R`, this is obtained by using `rle()` function. Is there any existing function in python which provides required output?