def _ChangeBit(byte, offset, bit_value):
  """Changes a bit of given offset.

  Args:
    byte: Input byte value in integer. Should be 0 ~ 255.
    offset: Bit offset needed to change.
    bit_value: Changed bit value. Should be 0 or 1.

  Returns:
    Modified byte value in integer.
  """
  if bit_value:
    return byte | (1 << offset)
  return byte & ~(1 << offset)