code: def write_version(name=None, path=None):
      
      # Written like this for coverage purposes.
      # http://stackoverflow.com/questions/5850268/how-to-test-or-mock-if-name-main-contents/27084447#27084447
      if name in (None, '__main__'):
          path = path or os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
                                      "version.json")
          contents = {
              'version': __version__,
              'version_string': __version_string__,
          }
          with open(path, 'w') as filehandle:
              filehandle.write(json.dumps(contents, sort_keys=True, indent=4))
docs: Write the version info to ../version.json, for setup.py.
  
      Args:
        name (Optional[str]): this is for the ``write_version(name=__name__)``
          below.  That's one way to both follow the
          ``if __name__ == '__main__':`` convention but also allow for full
          coverage without ignoring parts of the file.
  
        path (Optional[str]): the path to write the version json to.  Defaults
          to ../version.json