from typing import Sequence


def flatten(x: Sequence) -> list:
	"""
	Recursively flatten a list of lists (or tuples). Empty lists get replaced with "None" instead of completely vanishing.
	"""
	retme = []
	for thing in x:
		if isinstance(thing, (list, tuple)):
			if len(thing) == 0:
				retme.append(None)
			else:
				retme += flatten(thing)
		else:
			retme.append(thing)
	return retme