Get the last byte in the array and increment it

    :param bytes_string:
    :return:
199289
def _increment_last_byte(data):
    
    if not isinstance(data, bytes_types):
        if isinstance(data, six.string_types):
            data = data.encode('utf-8')
        else:
            data = six.b(str(data))
    s = bytearray(data)
    s[-1] = s[-1] + 1
    return bytes(s)
1034141
def add_0x(string):
    
    if isinstance(string, bytes):
        string = string.decode('utf-8')
    return '0x' + str(string)
1323422
def getbyteslice(self, start, end):
        """"""
        c = self._rawarray[start:end]
        return c
712232
def read_bytes(self, num_bytes):
        """"""
        buffer_size = len(self._buffer)
        if buffer_size > num_bytes:
            # The buffer is larger than the requested amount of bytes.
            data, self._buffer = self._buffer[:num_bytes], self._buffer[num_bytes:]
        elif 0 < buffer_size <= num_bytes:
            # This might return less bytes than requested.
            data, self._buffer = self._buffer, bytearray()
        else:
            # Buffer is empty. Try to read `num_bytes` and call `read_bytes()`
            # again. This ensures that at most `num_bytes` are returned.
            self._buffer += self.__read__(num_bytes)
            return self.read_bytes(num_bytes)
        return data
217115
def next_offsets(self):
        # type: (Descriptor) -> Offsets
        
        resume_bytes = self._resume()
        with self._meta_lock:
            if self._chunk_num >= self._total_chunks:
                return None, resume_bytes
            if self._offset + self._chunk_size > self._ase.size:
                num_bytes = self._ase.size - self._offset
            else:
                num_bytes = self._chunk_size
            chunk_num = self._chunk_num
            range_start = self._offset
            range_end = self._offset + num_bytes - 1
            self._offset += num_bytes
            self._chunk_num += 1
            if self._ase.is_encrypted and self._offset >= self._ase.size:
                pad = True
            else:
                pad = False
            return Offsets(
                chunk_num=chunk_num,
                num_bytes=num_bytes,
                range_start=range_start,
                range_end=range_end,
                pad=pad,
            ), resume_bytes
516147
function numToBytes(num, bytes) {
  if (bytes == 0) return [];else return [num % 256].concat(numToBytes(Math.floor(num / 256), bytes - 1));
}
132531
def unget_bytes(self, string):
        """"""

        self.unprocessed_bytes.extend(string[i:i + 1]
                                      for i in range(len(string)))
1153937
def endianSwapU16(bytes):
    """"""
    for b in range(0, len(bytes), 2):
        bytes[b], bytes[b + 1] = bytes[b + 1], bytes[b]
    return bytes
1034819
def bytes_to_int(b, order='big'):  # pragma: no cover
        """"""
        if six.PY2:
            # save the original type of b without having to copy any data
            _b = b.__class__()
            if order != 'little':
                b = reversed(b)

            if not isinstance(_b, bytearray):
                b = six.iterbytes(b)

            return sum(c << (i * 8) for i, c in enumerate(b))

        return int.from_bytes(b, order)
309167
def str_byte_index(haystack, needle, offset = 0)

      result = nil
      mb_idx = haystack.index(needle, offset)

      unless mb_idx.nil?

        if mb_idx < 1
          result = 0
        else
          matched = haystack.slice(0..mb_idx)
          result  = matched.bytesize - matched[-1].bytesize
        end
      end

      result
    end
501455
def read_bytes(self, count):
        
        result = self.input.read(count)
        found = len(result)
        self.lineno += result.count(b'\n')
        if found != count:
            self.abort(errors.MissingBytes, count, found)
        return result
476280
def get_bytes(self):
        

        pq_io = BytesIO()
        serialize_string(pq_io, self.pq)
        serialize_string(pq_io, self.p)
        serialize_string(pq_io, self.q)

        print("\nPQ")
        hexdump(self.pq)

        print("\nP")
        hexdump(self.p)

        print("\nQ")
        hexdump(self.q)

        print("\nPQ_io")
        hexdump(pq_io.getvalue())

        print("\nnonce")
        hexdump(self.nonce)

        print("\nserver_nonce")
        hexdump(self.server_nonce)

        print("\nnew_nonce")
        hexdump(self.new_nonce)

        ret = struct.pack("<I28s16s16s32s", p_q_inner_data.constructor, pq_io.getvalue(),
                           self.nonce, self.server_nonce, self.new_nonce)

        print("\np_q_inner_data")
        hexdump(ret)

        return ret
629496
private int bytesToInt(byte[] bytes)
    {
        int result = -1;
        if (bytes.length >= 4)
        {
            result = ((bytes[0]&0xff) << 24) +
                     ((bytes[1]&0xff) << 16) +
                     ((bytes[2]&0xff) << 8) +
                     (bytes[3]&0xff);
        }
        return result;
    }
892162
def bytes_array(self):
        ''''''
        assert len(self.dimensions) == 2, \
            '{}: cannot get value as bytes array!'.format(self.name)
        l, n = self.dimensions
        return [self.bytes[i*l:(i+1)*l] for i in range(n)]
146486
def data_from_base58(string)
      raise ArgumentError, "String is missing" if !string
      int = int_from_base58(string)
      bytes = []
      while int > 0
        remainder = int % 256
        int = int / 256
        bytes.unshift(remainder)
      end
      data = BTC::Data.data_from_bytes(bytes)
      byte_for_1 = "1".bytes.first
      BTC::Data.ensure_ascii_compatible_encoding(string).bytes.each do |byte|
        break if byte != byte_for_1
        data = "\x00" + data
      end
      data
    end
1300531
def frombytes(self, bytes, offset=0):
        
        for b in bytes:
            self._buf[offset] = b
            offset += 1
1138882
function (bytes) {
			for (var str = [], i = 0; i < bytes.length; i++)
				str.push(String.fromCharCode(bytes[i]));
			return str.join("");
		}