code: def extract_methods(node, code, methods, lang):
      if len(node.children) == 0:
          if node.type in function_node_name[lang]:
              methods.append(
                  {
                      "content": code[
                          node.start_byte : node.end_byte
                      ].decode("UTF-8"),
                      "range": list(
                          range(
                              node.start_point[0] + 1,
                              node.end_point[0] + 2,
                          )
                      ),
                      "start_byte": node.start_byte,
                      "end_byte": node.end_byte,
                      "type": node.type,
                      "node": node,
                  }
              )
      for child in node.children:
          if child.type in function_node_name[lang]:
              methods.append(
                  {
                      "content": code[
                          child.start_byte : child.end_byte
                      ].decode("UTF-8"),
                      "range": list(
                          range(
                              child.start_point[0] + 1,
                              child.end_point[0] + 2,
                          )
                      ),
                      "start_byte": child.start_byte,
                      "end_byte": child.end_byte,
                      "type": child.type,
                      "node": child,
                  }
              )
          methods = extract_methods(child, code, methods, lang)
      return methods
  
file_path: magicoder/experiments/extract_function_comment_pairs.py
imports: import os
  import json
  import argparse
  from tree_sitter import Language, Parser
  from pathlib import Path
  from treelib import Node, Tree
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling a global function with example usage: extract_methods(node, code, methods, lang) and returns: methods