<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def similarity1DdiffShapedArrays(arr1, arr2, normalize=False):
 """ compare two strictly monotonous increasing 1d arrays of same or different size return a similarity index-> 0=identical """

    # assign longer and shorter here, because jit cannot do it
    if len(arr1) < len(arr2):
        arr1, arr2 = arr2, arr1
    if not len(arr2):
        out = sum(arr1)
    else:
        out = _calc(arr1, arr2)

    if normalize:
        if not len(arr2):
            mn = arr1[0]
            mx = arr1[-1]
        else:
            mn = min(arr1[0], arr2[0])
            mx = max(arr1[-1], arr2[-1])
        out = out/ (mx - mn)

    return out