Refactored bytearray conversion out of nRF.py.