Simply check if a and b are both zero and raise an exception if they are:
a
b
>>> def powr(a,b): ... if a == b == 0: ... raise ValueError('Zero to the power zero') ... return a**b