import re
import binascii


def privkey_b64_bin(priv_b64):
	"""Convert a base-64 private key (ignoring whitespace) into a binary
	string."""
	# Cut out whitespace
	priv_b64 = re.sub("[ \t\n]", "", priv_b64)
	if len(priv_b64) in (44, 372):
		return binascii.a2b_base64(priv_b64)
	else:
		raise ValueError("Expected a key of 44 or 372 base-64 digits")