import re


def format_title(book_title):
	""" 
		Return formatted book title:
			"Actual Book Title! (Series identifier #3)" -> "Actual Book Title!"
			"History of 4D Fish Slapping [Silly, Part 4]" -> "History of 4D Fish Slapping"

		Along with CSV formatting
	"""
	book_title = ' '.join(book_title.split()).replace('&amp;', '&')
	book_title = re.sub(r'(\(|\[)(.*)(\)|\])','', book_title)
	book_title = '"' + book_title.replace('"', '""') + '"'
	if book_title[-2:-1] == ' ':
		book_title = book_title[:-2] + '"'
	return book_title