Code for mapping objects to bytes and bytes to objects.