Convert string from unicode to native format (required in Python 2).

def _unicode_to_native(s):
  """Convert string from unicode to native format (required in Python 2)."""
  if six.PY2:
    return s.encode("utf-8") if isinstance(s, unicode) else s
  else:
    return s