Put a 0
in front of the 12
to left-pad the output with zeroes.
In [1]: "{0:012b}".format(a)
Out[1]: '000000010111'
For the ones comp, the you could do string manipulation, or the math way:
In [2]: "{0:012b}".format(2**12-1-a)
Out[2]: '111111101000'
Just change the 2**12
to the number of digits you want to display