def max_run(_b, _x):
    """Determine the length of the maximum run of b's in vector x.

    Parameters
    ----------
    b: int
        Integer for counting.

    x: array
        Vector of integers.

    Returns
    -------
    max: int
        Length of maximum run of b's.
    """
    # Initialize counter
    _max = 0
    run = 0

    # Iterate through values in vector
    for i in _x:
        if i == _b:
            run += 1
        else:
            if run > _max:
                _max = run

            run = 0

    if (_x[-1] == _b) and (run > _max):
        _max = run

    return _max