Fix generate_examples build

- Add -march=native to host_copts and host_cxxopts in configure.py
- Make string.h for abstracting string differences at core interpreter level
- Use tensorflow special arg parse instead of flags
- Switch to using tool instead of data for dependency
- Fix python3  compatibility
  + Use six.StringIO instead of StringIO.StringIO
  + Use print_function
  + Properly set binary flags on TempFile's used in toco_convert
- Misc other path fixes

PiperOrigin-RevId: 174717673
diff --git a/configure.py b/configure.py
index bc7859f..6505417 100644
--- a/configure.py
+++ b/configure.py
@@ -25,10 +25,12 @@
 import subprocess
 import sys
 
+# pylint: disable=g-import-not-at-top
 try:
   from shutil import which
 except ImportError:
   from distutils.spawn import find_executable as which
+# pylint: enable=g-import-not-at-top
 
 _TF_BAZELRC = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                            '.tf_configure.bazelrc')
@@ -485,7 +487,10 @@
   cc_opt_flags = get_from_env_or_user_or_default(environ_cp, 'CC_OPT_FLAGS',
                                                  question, default_cc_opt_flags)
   for opt in cc_opt_flags.split():
-    write_to_bazelrc('build:opt --cxxopt=%s --copt=%s' % (opt, opt))
+    host_opt = '-march=native'  # It should be safe on the same build host.
+    write_to_bazelrc(
+        'build:opt --cxxopt=%s --copt=%s' % (opt, opt) +
+        ' --host_cxxopt=%s --host_copt=%s' % (host_opt, host_opt))
 
 
 def set_tf_cuda_clang(environ_cp):