def valid_bin(bin_val, width):
    if not _is_str(bin_val):
        return False

    if not bin_val.startswith('0b'):
        return False

    bin_val = bin_val.replace('0b', '')

    if len(bin_val) > width:
        return False

    max_int = 2 ** width - 1

    try:
        if 0 <= int(bin_val, 2) <= max_int:
            return True
    except ValueError:
        pass

    return False
Returns the type of the Lie algebra
dataset/ETHPy150Open drkjam/netaddr/netaddr/strategy/__init__.py/valid_bin--crossover with--dataset/ETHPy150Open sympy/sympy/sympy/liealgebras/cartan_type.py/Standard_Cartan.series