def read_nrevbytes(buffer: bytearray, length: int) -> bytes:
    """ Read and reverse the given number of bytes, read bytes are consumed.
    """
    array = bytes(reversed(buffer[:length]))
    del buffer[:length]
    return array