A = np.arange(0, 15).reshape(5, 3)
B=A.ravel()
D=A.flatten()
mass = [
[[1,2], [4, 5]],
[[5, 6], [7, 8]]
]
def one_m(l): return [one_m(sn) if all(map(lambda x: type(x)==type([]), sn)) else sn for sn in [[x for a in l for x in a]]][0]
print(one_m(mass))