<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def single_index(idxm):
 """ Multi-index to single integer notation. Uses graded reverse lexicographical notation. Parameters idxm : numpy.ndarray Index in multi-index notation Returns ------- idx : int Integer index of `idxm` Examples -------- 1 2 3 """

    if -1 in idxm:
        return 0
    order = int(sum(idxm))
    dim = len(idxm)
    if order == 0:
        return 0
    return terms(order-1, dim) + single_index(idxm[1:])