Added function to encode bytes and fix typo

_encode_bytes converts bytes into a buffer for _cmd