This way is faster and less lines of code. (as an interesting note)
def REF(A):
    size=A.shape[0]
    for i in xrange(size):
        A[i+1:,i:] -= np.outer((A[i+1:,i]/A[i,i]), A[i,i:])
    return A