<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def longest_run(da, dim='time'):
 """Return the length of the longest consecutive run of True values. Parameters arr : N-dimensional array (boolean) Input array dim : Xarray dimension (default = 'time') Dimension along which to calculate consecutive run Returns ------- N-dimensional array (int) Length of longest run of True values along dimension """


    d = rle(da, dim=dim)
    rl_long = d.max(dim=dim)

    return rl_long