code: def gen_doc_method_def(
      method, class_key, is_indx=False, with_self=True
  ):
      """Return python def as it should be written in docs"""
      param = ""
      snipet_link = ""
      method_name = method["def_name"]
      full_method_name = method_name
      if valid_dic_val(method, "static"):
          with_self = False
  
      # to correctly render methods like __init__ in md
      if method_name[0] == "_":
          method_name = "\\" + method_name
      if is_indx:
          method_name = bold(method_name)
      else:
          method_name = bold(color(COLOR_METHOD, method_name))
  
      if with_self:
          if not "params" in method or method["params"] is None:
              method["params"] = []
          method["params"].insert(0, {"param_name": "self"})
  
      if valid_dic_val(method, "params"):
          for p in method["params"]:
              default = (
                  join(["=", str(p["default"])])
                  if "default" in p
                  else ""
              )
              if is_indx:
                  param = join(
                      [param, bold(p["param_name"]), default, ", "]
                  )
              else:
                  param = join(
                      [
                          param,
                          color(
                              COLOR_PARAM,
                              bold(p["param_name"])
                              + create_hyperlinks(default),
                          ),
                          ", ",
                      ]
                  )
  
      if with_self:
          method["params"] = method["params"][1:]
          if not method["params"]:  # if is empty delete it
              del method["params"]
  
      param = param[:-2]  # delete the last ', '
  
      # Add snipet
      current_folder = os.path.dirname(os.path.abspath(__file__))
      snipets_path = os.path.join(
          current_folder, "../../Docs/python_api_snipets.md"
      )
      snipets = open(snipets_path, "r")
      if (
          class_key + "." + full_method_name + "-snipet"
          in snipets.read()
      ):
          snipet_link = snipet(full_method_name, class_key)
  
      return join([method_name, parentheses(param), snipet_link])
  
imports: import os
  import yaml
  import re
  import doc_gen_snipets
label_desc: Use image node_id 19 for calling a global function with example usage: gen_doc_method_def(method, class_key, is_indx, with_) and returns: join