code: def _ensure_args(G, start, i_start, directed):
      """
      Ensures the args passed in are usable for the API api_name and returns the
      args with proper defaults if not specified, or raises TypeError or
      ValueError if incorrectly specified.
      """
      # checks common to all input types
      if (start is not None) and (i_start is not None):
          raise TypeError("cannot specify both 'start' and 'i_start'")
      if (start is None) and (i_start is None):
          raise TypeError(
              "must specify 'start' or 'i_start', but not both"
          )
  
      start = start if start is not None else i_start
  
      G_type = type(G)
      # Check for Graph-type inputs
      if G_type is Graph or is_nx_graph_type(G_type):
          if directed is not None:
              raise TypeError(
                  "'directed' cannot be specified for a "
                  "Graph-type input"
              )
  
          # ensure start vertex is valid
          invalid_vertex_err = ValueError(
              "A provided vertex was not valid"
          )
          if is_nx_graph_type(G_type):
              if start not in G:
                  raise invalid_vertex_err
          else:
              if not isinstance(start, cudf.DataFrame):
                  if not isinstance(start, dask_cudf.DataFrame):
                      vertex_dtype = G.nodes().dtype
                      start = cudf.DataFrame(
                          {
                              "starts": cudf.Series(
                                  start, dtype=vertex_dtype
                              )
                          }
                      )
  
              if G.is_renumbered():
                  validlen = len(
                      G.renumber_map.to_internal_vertex_id(
                          start, start.columns
                      ).dropna()
                  )
                  if validlen < len(start):
                      raise invalid_vertex_err
              else:
                  el = G.edgelist.edgelist_df[["src", "dst"]]
                  col = start.columns[0]
                  null_l = (
                      el.merge(
                          start[col].rename("src"),
                          on="src",
                          how="right",
                      )
                      .dst.isnull()
                      .sum()
                  )
                  null_r = (
                      el.merge(
                          start[col].rename("dst"),
                          on="dst",
                          how="right",
                      )
                      .src.isnull()
                      .sum()
                  )
                  if null_l + null_r > 0:
                      raise invalid_vertex_err
  
      if directed is None:
          directed = True
  
      return (start, directed)
  
file_path: cugraph/python/cugraph/cugraph/traversal/bfs.py
imports: import cudf
  import dask_cudf
  from pylibcugraph import ResourceHandle
  from pylibcugraph import bfs
  from cugraph.structure.graph_classes import Graph
  from cugraph.utilities import ensure_cugraph_obj, is_matrix_type, is_cp_matrix_type, is_nx_graph_type, cupy_package
label_desc: Use image node_id 1 for calling a global function with example usage: _ensure_args(G, start, i_start, directed) and returns: start,  directed