code: def generate_ast(path):
      
      if os.path.isfile(path):
          with open(path, 'r') as f:
              try:
                  tree = ast.parse(f.read())
                  return PytTransformer().visit(tree)
              except SyntaxError:  # pragma: no cover
                  global recursive
                  if not recursive:
                      _convert_to_3(path)
                      recursive = True
                      return generate_ast(path)
                  else:
                      raise SyntaxError('The ast module can not parse the file'
                                        ' and the python 2 to 3 conversion'
                                        ' also failed.')
      raise IOError('Input needs to be a file. Path: ' + path)
docs: Generate an Abstract Syntax Tree using the ast module.
  
          Args:
              path(str): The path to the file e.g. example/foo/bar.py