docs: def arg_completions(
      completion_text: str,
      parent_function: str,
      args: list,
      arg_idx: int,
      bel_spec: BELSpec,
      bel_fmt: str,
      species_id: str,
      namespace: str,
      size: int,
  ):
      """Function argument completion
  
      Only allow legal options for completion given function name, arguments and index of argument
      to replace.
  
      Args:
          completion_text: text to use for completion - used for creating highlight
          parent_function: BEL function containing these args
          args: arguments of BEL function
          arg_idx: completing on this argument identified by this index
          bel_spec: BEL Specification
          bel_fmt: short, medium, long BEL function/relation formats
          species_id: filter on this species id, e.g. TAX:9606 if available
          namespace: filter on this namespace if available
          size: number of completions to return
  
      Return:
          list of replacements
      """
  
      function_long = bel_spec["functions"]["to_long"].get(parent_function)
      if not function_long:
          return []
  
      signatures = bel_spec["functions"]["signatures"][function_long]["signatures"]
  
      # Position based argument  ###################################
      function_list = []
      entity_types = []
      fn_replace_list, ns_arg_replace_list = [], []
      position_flag = False  # Signature matches position-based argument
  
      # Check for position based argument
      for signature in signatures:
          sig_arg = signature["arguments"][arg_idx]
          sig_type = sig_arg["type"]
  
          if sig_arg.get("position", False) and arg_idx == sig_arg["position"] - 1:
              position_flag = True
              if sig_type in ["Function", "Modifier"]:
                  function_list.extend(sig_arg["values"])
              elif sig_type in ["NSArg", "StrArgNSArg"]:
                  entity_types.extend(sig_arg["values"])
  
      if not position_flag:
          # Collect optional and multiple signature arguments for completion
          opt_fn_sig_args = []
          opt_nsarg_sig_args = []
          mult_fn_sig_args = []
          mult_nsarg_sig_args = []
          for signature in signatures:
              signature_opt_fn_sig_args = []
              signature_opt_nsarg_sig_args = []
              signature_mult_fn_sig_args = []
              signature_mult_nsarg_sig_args = []
              max_position = -1
              for sig_arg in signature["arguments"]:
                  if "position" in sig_arg:
                      max_position = sig_arg["position"]
                      continue  # Skip position based signature arguments
  
                  if (
                      sig_arg.get("optional", False) is True
                      and sig_arg.get("multiple", False) is False
                  ):
                      if sig_arg["type"] in ["Function", "Modifier"]:
                          signature_opt_fn_sig_args.extend(sig_arg["values"])
                      elif sig_arg["type"] in ["NSArg", "StrArgNSArg"]:
                          signature_opt_nsarg_sig_args.extend(sig_arg["values"])
                  elif sig_arg.get("multiple", False) is True:
                      if sig_arg["type"] in ["Function", "Modifier"]:
                          signature_mult_fn_sig_args.extend(sig_arg["values"])
                      elif sig_arg["type"] in ["NSArg", "StrArgNSArg"]:
                          signature_mult_nsarg_sig_args.extend(sig_arg["values"])
  
              # Remove signature non-multiple, optional arguments that are already in args list
              for idx, arg in enumerate(args):
                  if idx <= max_position - 1:  # Skip positional arguments
                      continue
                  if idx == arg_idx:  # Skip argument to be completed
                      continue
                  log.debug(f"Remove Optional Args {arg}  {signature_opt_fn_sig_args}")
  
              opt_fn_sig_args.extend(signature_opt_fn_sig_args)
              opt_nsarg_sig_args.extend(signature_opt_nsarg_sig_args)
              mult_fn_sig_args.extend(signature_mult_fn_sig_args)
              mult_nsarg_sig_args.extend(signature_mult_nsarg_sig_args)
  
          function_list.extend(list(set(opt_fn_sig_args + mult_fn_sig_args)))
          entity_types.extend(list(set(opt_nsarg_sig_args + mult_nsarg_sig_args)))
  
      if function_list:
          log.debug(f"ArgComp - position-based Function list: {function_list}")
          fn_replace_list = function_completions(
              completion_text, bel_spec, function_list, bel_fmt, size
          )
  
      if entity_types:
          log.debug(f"ArgComp - position-based Entity types: {entity_types}")
          ns_arg_replace_list = nsarg_completions(
              completion_text,
              entity_types,
              bel_spec,
              namespace,
              species_id,
              bel_fmt,
              size,
          )
  
      replace_list = fn_replace_list + ns_arg_replace_list
  
      return replace_list