def getBinaryRep(n, numDigits):
	result = ''
	while n>0:
		result = str(n%2)+result
		n = n//2
	if len(result)>numDigits:
		raise ValueError('not enough digits')
	for i in range(numDigits - len(result)):
		result = '0' + result
	return result

def getPowerset(L):
	powerset = []
	for i in range(0,2**len(L)):
		binStr = getBinaryRep(i,len(L))
		print(binStr)
		subset = []
		for j in range(len(L)):
			if binStr[j] == '1':
				subset.append(L[j])
		powerset.append(subset)
	return powerset

def test():
	L = [1,'a',2,3]
	print(getPowerset(L))
test()