Convert to bytes for py3