code: def ipynb_to_rst(directory, filename):
      
      print(filename)
      os.chdir(directory)
      subprocess.Popen(["ipython", "nbconvert", "--to", "rst",
                        filename],
                       stdout=subprocess.PIPE,
                       stderr=subprocess.PIPE,
                       cwd=directory)
docs: Converts a given file in a directory to an rst in the same directory.