def bcd_digit(sn):
	"""converts decimal digit char to 4 char binary 0 and 1 representation"""
	n = int(sn)
	try:
		bin_nr = bin(n)[2:]
	except NameError:
		bin_nr = bin_old(n)
	return ('0000' + bin_nr)[-4:]
converts decimal digit char to 4 char binary 0 and 1 representation
recipes/Python/577430_Binary_BCD_clock_using_curses/recipe-577430.py