code: def _ensure_args(
      G,
      source,
      method,
      directed,
      return_predecessors,
      unweighted,
      overwrite,
      indices,
  ):
      """
      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 (method is not None) and (method != "auto"):
          raise ValueError(
              "only 'auto' is currently accepted for method"
          )
      if (indices is not None) and (type(indices) == list):
          raise ValueError(
              "indices currently cannot be a list-like type"
          )
      if (indices is not None) and (source is not None):
          raise TypeError("cannot specify both 'source' and 'indices'")
      if (indices is None) and (source is None):
          raise TypeError(
              "must specify 'source' or 'indices', but not both"
          )
  
      G_type = type(G)
      # Check for Graph-type inputs
      if G_type is Graph or is_nx_graph_type(G_type):
          # FIXME: Improve Graph-type checking
          exc_value = "'%s' cannot be specified for a Graph-type input"
          if directed is not None:
              raise TypeError(exc_value % "directed")
          if return_predecessors is not None:
              raise TypeError(exc_value % "return_predecessors")
          if unweighted is not None:
              raise TypeError(exc_value % "unweighted")
          if overwrite is not None:
              raise TypeError(exc_value % "overwrite")
  
          # Ensure source vertex is valid
          invalid_vertex_err = ValueError(
              f"Vertex {source} is not valid for the NetworkX Graph"
          )
          if is_nx_graph_type(G_type) and source not in G:
              raise invalid_vertex_err
          elif indices is None and not G.has_node(source):
              raise invalid_vertex_err
  
          directed = False
  
      # Check for non-Graph-type inputs
      else:
          if (directed is not None) and (type(directed) != bool):
              raise ValueError("'directed' must be a bool")
          if (return_predecessors is not None) and (
              type(return_predecessors) != bool
          ):
              raise ValueError("'return_predecessors' must be a bool")
          if (unweighted is not None) and (unweighted is not True):
              raise ValueError(
                  "'unweighted' currently must be True if " "specified"
              )
          if (overwrite is not None) and (overwrite is not False):
              raise ValueError(
                  "'overwrite' currently must be False if " "specified"
              )
  
      source = source if source is not None else indices
      if return_predecessors is None:
          return_predecessors = True
  
      return (source, directed, return_predecessors)
  
file_path: cugraph/python/cugraph/cugraph/traversal/sssp.py
imports: import numpy
  import cudf
  from cugraph.structure import Graph, MultiGraph
  from cugraph.utilities import ensure_cugraph_obj, is_matrix_type, is_cp_matrix_type, is_nx_graph_type, cupy_package
  from pylibcugraph import sssp, ResourceHandle
label_desc: Use image node_id 1 for calling a global function with example usage: _ensure_args(G, source, method, directed, return_predecessors, unweighted, overwrite, indices) and returns: source,  directed,  return_predecessors