'Encode bytes in given data, keeping track of the path traversed.'

def _encode(self, data, path):

    if isinstance(data, dict):
        return self._encode_dict(data, path)
    elif isinstance(data, list):
        return self._encode_list(data, path)
    elif isinstance(data, six.binary_type):
        return self._encode_bytes(data, path)
    else:
        return (data, [])
