added helper function for lazy bytestring encoding