#python code
def flat(x):
if type(x) == type([]) and len(x)==1:
return flat(x[0])
if type(x) == type([]) and len(x)>1:
return flat(x[0]) + flat(x[1:])
else:
return [x]