code: def binarize_helper(tree):
      prev_word = ""
  
      for index, word in enumerate(tree):
          if word != "(" and word != ")":
              if prev_word == "(":
                  if index < len(tree) - 1:
                      if tree[index + 1] == ")":
                          return binarize_helper(
                              tree[: index - 1]
                              + [tree[index]]
                              + tree[index + 2 :]
                          )
          prev_word = word
  
      for index, word in enumerate(tree):
          if word != "(" and word != ")":
              if prev_word == "(":
                  if index < len(tree) - 2:
                      if (
                          tree[index + 1] != ")"
                          and tree[index + 1] != "("
                          and tree[index + 2] == ")"
                      ):
                          return binarize_helper(
                              tree[: index - 1]
                              + [" ".join(tree[index - 1 : index + 3])]
                              + tree[index + 3 :]
                          )
          prev_word = word
  
      for index, word in enumerate(tree):
          if word == ")":
              if index > 2:
                  if (
                      tree[index - 1] != "("
                      and tree[index - 1] != ")"
                      and tree[index - 2] != "("
                      and tree[index - 2] != ")"
                      and tree[index - 3] != "("
                      and tree[index - 3] != ")"
                  ):
                      return binarize_helper(
                          tree[: index - 2]
                          + [
                              "( "
                              + tree[index - 2]
                              + " "
                              + tree[index - 1]
                              + " )"
                          ]
                          + tree[index:]
                      )
  
      return tree
  
file_path: textflint/textflint/common/utils/overlap_templates.py
imports: import random
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: binarize_helper(tree) and returns: tree, binarize_helper, binarize_helper, binarize_helper