Moved kz calc to separate function

The calculation of Kz has been moved out of the main encoder section to
an independent function allowing it to be tested properly. The unit test
for kz has also been implemented in CCSDS_test.py
Testing for intermittent bug in encoder