I'm having some trouble finding a function that converts numbers (whether integer, hex, whatever) to its binary representation. Is there one?

Thanks.

Get the Gnu Multiple Precision library for Python module (Google GMPY).

import gmpy help(gmpy.digits)
Help on built-in function digits:
digits(...)
digits(x[,base]): returns Python string representing x in the
given base (2 to 36, default 10 if omitted or 0); leading '-'
present if x<0, but no leading '+' if x>=0. x must be an mpz,
or else gets coerced into one.
for i in range(16):