def process_pane_capture_lines(data, nlines=None):
	"""Given the string blob of data from `tmux capture-pane`, returns an array of line strings.

	Arguments:
		data -- String blob of data from `tmux capture-pane`
		nlines -- Maximum number of lines to return

	Returns:
		An array of line strings.  Each line string corresponds to a single visible line such that
		a wrapped line is returned as multiple visible lines.  Nonprintable characters are removed
		and tabs are converted to spaces.
	"""
	# processes pane capture data into an array of lines
	# also handles nonprintables
	lines = [
		''.join([
			'        ' if c == '\t' else (
				c if c.isprintable() else ''
			)
			for c in line
		])
		for line in data.split('\n')
	]
	if nlines != None:
		lines = lines[:nlines]
	return lines