def deepmap(func, *seqs):
 if isinstance(seqs[0], (list, Iterator)):
  return [deepmap(func, *items) for items in zip(*seqs)]
 else:
  return func(*seqs)

def deepmap ( func , * seqs ) : if isinstance ( seqs [ 0 ] , ( list , Iterator ) ) : return [ deepmap ( func , * items ) for items in zip ( * seqs ) ] else : return func ( * seqs )
apply function inside nested lists .