def bin_to_int(bin_val, width):
    if not valid_bin(bin_val, width):
        raise ValueError('not a valid Python binary string: %r!' % bin_val)

    return int(bin_val.replace('0b', ''), 2)
:param bin_val: A string containing an unsigned integer in Python's binary
dataset/ETHPy150Open drkjam/netaddr/netaddr/strategy/__init__.py/bin_to_int