A lot of the code is littered with conditional checks against types of objects, to see if they are e.g. a local process, SSH process, or Android process.

This code would be greatly simplified if there were an abstraction layer that provided basic file I/O. Since the bounding set on functionality is what is provided by Paramiko's SFTP object, we should just implement that interface.

For things which resemble processes, we can add a property e.g. hal or filesystem which is an object which exposes this functionality. An example use-case is fetching a core file, one could just process.filesystem.open('core').read().

In order to achieve this, it seems best to convert the internal usage of ASCII/Latin-1 strings (Python2 str) into bytearray objects. The bytearray type is unique in that it is native to both Python2 and Python3, and avoids all internal issues with encoding/decoding.