Fix build issue while creating Python API
Fix build issue while creating Python API

This fix tries to address the issue raised in 20233 where
build could fail with the following error:
```
"/var/tmp/portage/sci-libs/tensorflow-1.9.0_rc1/work/bazel-base-python3_6/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/tools/api/generator/create_python_api.runfiles/org_tensorflow/tensorflow/tools/api/generator/create_python_api.py", line 182, in get_api_init_text
    package not in module.__name__):
TypeError: argument of type 'NoneType' is not iterable
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 3202.457s, Critical Path: 83.98s
INFO: 4901 processes, local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
```

This fix addresses the issue.

This fix fixes 20233.

NOTE: The patch is provided by @cjmayo

Signed-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>

freedomtan/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow,dancingdan/tensorflow,renyi533/tensorflow,xzturn/tensorflow,ageron/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,davidzchen/tensorflow,karllessard/tensorflow,drpngx/tensorflow,paolodedios/tensorflow,alsrgv/tensorflow,apark263/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,girving/tensorflow,adit-chandra/tensorflow,hehongliang/tensorflow,yongtang/tensorflow,xodus7/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,renyi533/tensorflow,aam-at/tensorflow,gautam1858/tensorflow,aselle/tensorflow,drpngx/tensorflow,AnishShah/tensorflow,alsrgv/tensorflow,alsrgv/tensorflow,ZhangXinNan/tensorflow,alshedivat/tensorflow,drpngx/tensorflow,dancingdan/tensorflow,yongtang/tensorflow,annarev/tensorflow,freedomtan/tensorflow,xodus7/tensorflow,jbedorf/tensorflow,drpngx/tensorflow,tensorflow/tensorflow,xodus7/tensorflow,renyi533/tensorflow,xzturn/tensorflow,meteorcloudy/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,jbedorf/tensorflow,davidzchen/tensorflow,snnn/tensorflow,jbedorf/tensorflow,yongtang/tensorflow,xodus7/tensorflow,AnishShah/tensorflow,chemelnucfin/tensorflow,asimshankar/tensorflow,jendap/tensorflow,yongtang/tensorflow,xzturn/tensorflow,jhseu/tensorflow,meteorcloudy/tensorflow,arborh/tensorflow,ghchinoy/tensorflow,jart/tensorflow,jhseu/tensorflow,jalexvig/tensorflow,freedomtan/tensorflow,manipopopo/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_saved_model,dancingdan/tensorflow,jalexvig/tensorflow,asimshankar/tensorflow,kobejean/tensorflow,petewarden/tensorflow,theflofly/tensorflow,Intel-tensorflow/tensorflow,adit-chandra/tensorflow,jart/tensorflow,kobejean/tensorflow,apark263/tensorflow,seanli9jan/tensorflow,xodus7/tensorflow,ageron/tensorflow,xodus7/tensorflow,cxxgtxy/tensorflow,renyi533/tensorflow,ghchinoy/tensorflow,karllessard/tensorflow,annarev/tensorflow,dancingdan/tensorflow,frreiss/tensorflow-fred,ppwwyyxx/tensorflow,adit-chandra/tensorflow,aam-at/tensorflow,manipopopo/tensorflow,asimshankar/tensorflow,tensorflow/tensorflow-pywrap_saved_model,kevin-coder/tensorflow-fork,DavidNorman/tensorflow,asimshankar/tensorflow,annarev/tensorflow,jendap/tensorflow,Bismarrck/tensorflow,renyi533/tensorflow,frreiss/tensorflow-fred,jalexvig/tensorflow,ghchinoy/tensorflow,paolodedios/tensorflow,renyi533/tensorflow,jhseu/tensorflow,DavidNorman/tensorflow,xzturn/tensorflow,arborh/tensorflow,jendap/tensorflow,annarev/tensorflow,aldian/tensorflow,kobejean/tensorflow,aldian/tensorflow,jendap/tensorflow,kevin-coder/tensorflow-fork,alsrgv/tensorflow,jalexvig/tensorflow,tensorflow/tensorflow-pywrap_saved_model,xzturn/tensorflow,brchiu/tensorflow,snnn/tensorflow,davidzchen/tensorflow,girving/tensorflow,Intel-tensorflow/tensorflow,adit-chandra/tensorflow,AnishShah/tensorflow,dancingdan/tensorflow,jart/tensorflow,ppwwyyxx/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,brchiu/tensorflow,annarev/tensorflow,karllessard/tensorflow,manipopopo/tensorflow,aselle/tensorflow,gautam1858/tensorflow,DavidNorman/tensorflow,drpngx/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,cxxgtxy/tensorflow,dongjoon-hyun/tensorflow,theflofly/tensorflow,jbedorf/tensorflow,snnn/tensorflow,chemelnucfin/tensorflow,meteorcloudy/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,ZhangXinNan/tensorflow,ageron/tensorflow,Intel-Corporation/tensorflow,xzturn/tensorflow,chemelnucfin/tensorflow,ZhangXinNan/tensorflow,dancingdan/tensorflow,dongjoon-hyun/tensorflow,sarvex/tensorflow,petewarden/tensorflow,frreiss/tensorflow-fred,theflofly/tensorflow,kevin-coder/tensorflow-fork,theflofly/tensorflow,aam-at/tensorflow,petewarden/tensorflow,yongtang/tensorflow,caisq/tensorflow,adit-chandra/tensorflow,ageron/tensorflow,karllessard/tensorflow,gunan/tensorflow,freedomtan/tensorflow,petewarden/tensorflow,jbedorf/tensorflow,aselle/tensorflow,petewarden/tensorflow,paolodedios/tensorflow,arborh/tensorflow,kevin-coder/tensorflow-fork,AnishShah/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,freedomtan/tensorflow,xzturn/tensorflow,ageron/tensorflow,kevin-coder/tensorflow-fork,manipopopo/tensorflow,yongtang/tensorflow,Intel-Corporation/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow,kevin-coder/tensorflow-fork,tensorflow/tensorflow,paolodedios/tensorflow,jalexvig/tensorflow,DavidNorman/tensorflow,adit-chandra/tensorflow,hfp/tensorflow-xsmm,theflofly/tensorflow,alshedivat/tensorflow,caisq/tensorflow,tensorflow/tensorflow-pywrap_saved_model,frreiss/tensorflow-fred,meteorcloudy/tensorflow,kobejean/tensorflow,DavidNorman/tensorflow,DavidNorman/tensorflow,jart/tensorflow,aselle/tensorflow,alsrgv/tensorflow,aldian/tensorflow,ppwwyyxx/tensorflow,karllessard/tensorflow,hfp/tensorflow-xsmm,gunan/tensorflow,paolodedios/tensorflow,arborh/tensorflow,seanli9jan/tensorflow,aldian/tensorflow,aldian/tensorflow,ageron/tensorflow,jhseu/tensorflow,xzturn/tensorflow,Intel-tensorflow/tensorflow,aldian/tensorflow,jbedorf/tensorflow,annarev/tensorflow,seanli9jan/tensorflow,renyi533/tensorflow,asimshankar/tensorflow,ppwwyyxx/tensorflow,girving/tensorflow,tensorflow/tensorflow,snnn/tensorflow,jalexvig/tensorflow,hehongliang/tensorflow,gautam1858/tensorflow,ghchinoy/tensorflow,Bismarrck/tensorflow,karllessard/tensorflow,DavidNorman/tensorflow,ZhangXinNan/tensorflow,gautam1858/tensorflow,chemelnucfin/tensorflow,renyi533/tensorflow,Intel-tensorflow/tensorflow,seanli9jan/tensorflow,apark263/tensorflow,tensorflow/tensorflow,snnn/tensorflow,alsrgv/tensorflow,paolodedios/tensorflow,asimshankar/tensorflow,brchiu/tensorflow,Bismarrck/tensorflow,meteorcloudy/tensorflow,cxxgtxy/tensorflow,gunan/tensorflow,drpngx/tensorflow,jendap/tensorflow,drpngx/tensorflow,sarvex/tensorflow,snnn/tensorflow,frreiss/tensorflow-fred,jhseu/tensorflow,gunan/tensorflow,theflofly/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,jalexvig/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gautam1858/tensorflow,Intel-Corporation/tensorflow,aam-at/tensorflow,girving/tensorflow,hfp/tensorflow-xsmm,apark263/tensorflow,ageron/tensorflow,freedomtan/tensorflow,arborh/tensorflow,frreiss/tensorflow-fred,sarvex/tensorflow,ZhangXinNan/tensorflow,gunan/tensorflow,jbedorf/tensorflow,davidzchen/tensorflow,gautam1858/tensorflow,drpngx/tensorflow,jart/tensorflow,caisq/tensorflow,aselle/tensorflow,xodus7/tensorflow,dongjoon-hyun/tensorflow,xzturn/tensorflow,Bismarrck/tensorflow,xodus7/tensorflow,snnn/tensorflow,dancingdan/tensorflow,jbedorf/tensorflow,Intel-Corporation/tensorflow,aselle/tensorflow,tensorflow/tensorflow,ageron/tensorflow,girving/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,kevin-coder/tensorflow-fork,brchiu/tensorflow,annarev/tensorflow,aldian/tensorflow,girving/tensorflow,jbedorf/tensorflow,snnn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,ageron/tensorflow,jart/tensorflow,xzturn/tensorflow,gunan/tensorflow,alsrgv/tensorflow,brchiu/tensorflow,Bismarrck/tensorflow,gunan/tensorflow,jhseu/tensorflow,kobejean/tensorflow,ppwwyyxx/tensorflow,DavidNorman/tensorflow,seanli9jan/tensorflow,cxxgtxy/tensorflow,seanli9jan/tensorflow,manipopopo/tensorflow,ZhangXinNan/tensorflow,alshedivat/tensorflow,kobejean/tensorflow,alsrgv/tensorflow,aam-at/tensorflow,AnishShah/tensorflow,kobejean/tensorflow,alshedivat/tensorflow,drpngx/tensorflow,dongjoon-hyun/tensorflow,dongjoon-hyun/tensorflow,davidzchen/tensorflow,aam-at/tensorflow,kobejean/tensorflow,chemelnucfin/tensorflow,apark263/tensorflow,hfp/tensorflow-xsmm,alsrgv/tensorflow,frreiss/tensorflow-fred,frreiss/tensorflow-fred,yongtang/tensorflow,AnishShah/tensorflow,seanli9jan/tensorflow,aam-at/tensorflow,aam-at/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,paolodedios/tensorflow,dancingdan/tensorflow,Intel-tensorflow/tensorflow,AnishShah/tensorflow,caisq/tensorflow,renyi533/tensorflow,Bismarrck/tensorflow,dongjoon-hyun/tensorflow,hfp/tensorflow-xsmm,caisq/tensorflow,ppwwyyxx/tensorflow,Intel-tensorflow/tensorflow,arborh/tensorflow,ghchinoy/tensorflow,DavidNorman/tensorflow,DavidNorman/tensorflow,hfp/tensorflow-xsmm,caisq/tensorflow,gautam1858/tensorflow,ZhangXinNan/tensorflow,hehongliang/tensorflow,dongjoon-hyun/tensorflow,paolodedios/tensorflow,jbedorf/tensorflow,yongtang/tensorflow,ppwwyyxx/tensorflow,gunan/tensorflow,alshedivat/tensorflow,AnishShah/tensorflow,apark263/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,jhseu/tensorflow,jendap/tensorflow,adit-chandra/tensorflow,ageron/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,freedomtan/tensorflow,girving/tensorflow,ppwwyyxx/tensorflow,theflofly/tensorflow,sarvex/tensorflow,jhseu/tensorflow,Bismarrck/tensorflow,alshedivat/tensorflow,theflofly/tensorflow,aam-at/tensorflow,alshedivat/tensorflow,gunan/tensorflow,gunan/tensorflow,jalexvig/tensorflow,tensorflow/tensorflow-pywrap_saved_model,ghchinoy/tensorflow,jart/tensorflow,tensorflow/tensorflow-pywrap_saved_model,apark263/tensorflow,jart/tensorflow,snnn/tensorflow,chemelnucfin/tensorflow,tensorflow/tensorflow,aam-at/tensorflow,jalexvig/tensorflow,gautam1858/tensorflow,alshedivat/tensorflow,manipopopo/tensorflow,theflofly/tensorflow,petewarden/tensorflow,kobejean/tensorflow,hfp/tensorflow-xsmm,dongjoon-hyun/tensorflow,xzturn/tensorflow,tensorflow/tensorflow,drpngx/tensorflow,petewarden/tensorflow,asimshankar/tensorflow,petewarden/tensorflow,manipopopo/tensorflow,dongjoon-hyun/tensorflow,alsrgv/tensorflow,xodus7/tensorflow,alsrgv/tensorflow,yongtang/tensorflow,sarvex/tensorflow,seanli9jan/tensorflow,ppwwyyxx/tensorflow,aselle/tensorflow,hfp/tensorflow-xsmm,tensorflow/tensorflow,karllessard/tensorflow,paolodedios/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,ghchinoy/tensorflow,dancingdan/tensorflow,Bismarrck/tensorflow,caisq/tensorflow,dongjoon-hyun/tensorflow,caisq/tensorflow,DavidNorman/tensorflow,cxxgtxy/tensorflow,chemelnucfin/tensorflow,adit-chandra/tensorflow,DavidNorman/tensorflow,brchiu/tensorflow,AnishShah/tensorflow,adit-chandra/tensorflow,chemelnucfin/tensorflow,cxxgtxy/tensorflow,arborh/tensorflow,manipopopo/tensorflow,ppwwyyxx/tensorflow,seanli9jan/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,jart/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,jendap/tensorflow,alshedivat/tensorflow,aselle/tensorflow,alshedivat/tensorflow,caisq/tensorflow,brchiu/tensorflow,girving/tensorflow,annarev/tensorflow,xzturn/tensorflow,annarev/tensorflow,Intel-tensorflow/tensorflow,ageron/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,petewarden/tensorflow,freedomtan/tensorflow,Bismarrck/tensorflow,girving/tensorflow,hfp/tensorflow-xsmm,meteorcloudy/tensorflow,ghchinoy/tensorflow,yongtang/tensorflow,ZhangXinNan/tensorflow,yongtang/tensorflow,ppwwyyxx/tensorflow,alsrgv/tensorflow,dongjoon-hyun/tensorflow,manipopopo/tensorflow,aselle/tensorflow,jbedorf/tensorflow,petewarden/tensorflow,Bismarrck/tensorflow,meteorcloudy/tensorflow,gautam1858/tensorflow,theflofly/tensorflow,meteorcloudy/tensorflow,davidzchen/tensorflow,gunan/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,snnn/tensorflow,Bismarrck/tensorflow,jbedorf/tensorflow,brchiu/tensorflow,kobejean/tensorflow,ghchinoy/tensorflow,jart/tensorflow,karllessard/tensorflow,aselle/tensorflow,jalexvig/tensorflow,renyi533/tensorflow,ghchinoy/tensorflow,adit-chandra/tensorflow,hehongliang/tensorflow,gautam1858/tensorflow,davidzchen/tensorflow,aam-at/tensorflow,asimshankar/tensorflow,apark263/tensorflow,adit-chandra/tensorflow,renyi533/tensorflow,kevin-coder/tensorflow-fork,caisq/tensorflow,Intel-Corporation/tensorflow,arborh/tensorflow,asimshankar/tensorflow,hehongliang/tensorflow,paolodedios/tensorflow,arborh/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,girving/tensorflow,davidzchen/tensorflow,jhseu/tensorflow,aldian/tensorflow,ZhangXinNan/tensorflow,seanli9jan/tensorflow,kevin-coder/tensorflow-fork,freedomtan/tensorflow,freedomtan/tensorflow,AnishShah/tensorflow,snnn/tensorflow,gunan/tensorflow,theflofly/tensorflow,cxxgtxy/tensorflow,davidzchen/tensorflow,ageron/tensorflow,tensorflow/tensorflow-pywrap_saved_model,meteorcloudy/tensorflow,arborh/tensorflow,kevin-coder/tensorflow-fork,xodus7/tensorflow,hfp/tensorflow-xsmm,kobejean/tensorflow,freedomtan/tensorflow,jendap/tensorflow,ghchinoy/tensorflow,dancingdan/tensorflow,brchiu/tensorflow,hehongliang/tensorflow,jalexvig/tensorflow,jendap/tensorflow,asimshankar/tensorflow,ghchinoy/tensorflow,kevin-coder/tensorflow-fork,chemelnucfin/tensorflow,brchiu/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,brchiu/tensorflow,asimshankar/tensorflow,frreiss/tensorflow-fred,davidzchen/tensorflow,xodus7/tensorflow,dancingdan/tensorflow,arborh/tensorflow,sarvex/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_once,ZhangXinNan/tensorflow,theflofly/tensorflow,tensorflow/tensorflow-pywrap_saved_model,jhseu/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,apark263/tensorflow,meteorcloudy/tensorflow,manipopopo/tensorflow,cxxgtxy/tensorflow,petewarden/tensorflow,girving/tensorflow,chemelnucfin/tensorflow,jhseu/tensorflow,AnishShah/tensorflow,annarev/tensorflow,annarev/tensorflow,jendap/tensorflow,alshedivat/tensorflow,chemelnucfin/tensorflow,jendap/tensorflow,manipopopo/tensorflow,ppwwyyxx/tensorflow,seanli9jan/tensorflow,sarvex/tensorflow,gautam1858/tensorflow,arborh/tensorflow,Intel-tensorflow/tensorflow,ZhangXinNan/tensorflow,Intel-Corporation/tensorflow,chemelnucfin/tensorflow,freedomtan/tensorflow,apark263/tensorflow,aselle/tensorflow,apark263/tensorflow,Intel-tensorflow/tensorflow,hfp/tensorflow-xsmm,sarvex/tensorflow,hehongliang/tensorflow