def get_bs(data, offset=0):
    """ Read an extensible byte serialised unsigned int from `data` at `offset`.
      Return value and new offset.

      Continuation octets have their high bit set.
      The value is big-endian.

      If you just have a bytes instance, this is the go. If you're
      reading from a stream you're better off with `cs.binary.BSUint`.
  """
    n = 0
    b = 128
    while b & 128:
        b = data[offset]
        offset += 1
        n = n << 7 | b & 127
    return n, offset
