I realize that this is a very old question, but it comes up first on Google, so I'll add a solution for signed integers, and additional solutions for a slight variant of the OPs use case, which incorporates some features from the answers above.
If you want the width of an unsigned int in byte, you can just divide the bit length by 8 and take the ceiling:
from math import ceil
bytewidth = ceil(unsigned_value.bit_length() / 8)
This is equivalent or the same as a number of the answers already posted.
For a signed int, you need to add an extra bit to the bit length reported by Python to account for the sign - otherwise you we get a width of e.g. 15 for -32767:
from math import ceil
bytewidth = ceil((signed_value.bit_length() + 1 )/ 8)
Rather than the bytewidth, you may instead be more interested in the common C type or numpy dtype required to store the value i.e. do we need an int16 or an int32, etc.. These have bit widths that are powers of two, so we need to do a bit more work, by taking an additional logarithm to base 2, and ceiling before taking 2 to power of the result:
from math import ceil, log
uvalue_width = 2**ceil(log(unsigned_value.bit_length(), 2))
value_width = 2**ceil(log(signed_value.bit_length() + 1), 2))
You can then get the name of the correct type with e.g.:
utype_name = f'uint{uvalue_width}'
type_name = f'int{value_width}'