code: def ensure_valid_dtype(input_graph, input_df, input_df_name):
      if input_graph.edgelist.weights is False:
          # If the graph is not weighted, an artificial weight column
          # of type 'float32' is added and it must match the user
          # personalization/nstart values.
          edge_attr_dtype = np.float32
      else:
          edge_attr_dtype = input_graph.edgelist.edgelist_df[
              "weights"
          ].dtype
  
      if "values" in input_df.columns:
          input_df_values_dtype = input_df["values"].dtype
          if input_df_values_dtype != edge_attr_dtype:
              warning_msg = (
                  f"PageRank requires '{input_df_name}' values "
                  "to match the graph's 'edge_attr' type. "
                  f"edge_attr type is: {edge_attr_dtype} and got "
                  f"'{input_df_name}' values of type: "
                  f"{input_df_values_dtype}."
              )
              warnings.warn(warning_msg, UserWarning)
              input_df = input_df.astype({"values": edge_attr_dtype})
  
      vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0]
      input_df_vertex_dtype = input_df["vertex"].dtype
      if input_df_vertex_dtype != vertex_dtype:
          warning_msg = (
              f"PageRank requires '{input_df_name}' vertex "
              "to match the graph's 'vertex' type. "
              f"input graph's vertex type is: {vertex_dtype} and got "
              f"'{input_df_name}' vertex of type: "
              f"{input_df_vertex_dtype}."
          )
          warnings.warn(warning_msg, UserWarning)
          input_df = input_df.astype({"vertex": vertex_dtype})
  
      return input_df
  
file_path: cugraph/python/cugraph/cugraph/link_analysis/pagerank.py
imports: import warnings
  import cudf
  import numpy
  from pylibcugraph import pagerank, personalized_pagerank, exceptions, ResourceHandle
  from cugraph.utilities import ensure_cugraph_obj_for_nx, df_score_to_dictionary
  from cugraph.exceptions import FailedToConvergeError
label_desc: Use image node_id 2 for calling a global function with example usage: ensure_valid_dtype(input_graph, input_df, input_df_name) and returns: input_df