Given a URL or filename, infer the compression code for tar.

def infer_compression(url):
	"""
	Given a URL or filename, infer the compression code for tar.
	"""
	# cheat and just assume it's the last two characters
	compression_indicator = url[-2:]
	mapping = dict(
		gz='z',
		bz='j',
		xz='J',
	)
	# Assume 'z' (gzip) if no match
	return mapping.get(compression_indicator, 'z')