code: def create_homogeneous_sampled_graphs_from_dataframe(
      sampled_df: cudf.DataFrame,
      edge_dir: str = "in",
      return_type: str = "dgl.Block",
  ):
      """
      This helper function creates DGL MFGS  for
      homogeneous graphs from cugraph sampled dataframe
  
      Args:
          sampled_df (cudf.DataFrame): The sampled cuDF DataFrame containing
              columns `sources`, `destinations`, `edge_id`, `batch_id` and
              `hop_id`.
          edge_dir (str): Direction of edges from samples
      Returns:
          list: A list containing three elements:
              - input_nodes: The input nodes for the batch.
              - output_nodes: The output nodes for the batch.
              - graph_per_hop_ls: A list of DGL MFGS for each hop.
      """
      if return_type not in ["dgl.Block", "cugraph_dgl.nn.SparseGraph"]:
          raise ValueError(
              "return_type must be either dgl.Block or cugraph_dgl.nn.SparseGraph"
          )
  
      result_tensor_d = _get_tensor_d_from_sampled_df(sampled_df)
      del sampled_df
      result_mfgs = [
          _create_homogeneous_sampled_graphs_from_tensors_perhop(
              tensors_batch_d, edge_dir, return_type
          )
          for tensors_batch_d in result_tensor_d.values()
      ]
      del result_tensor_d
      return result_mfgs
  
imports: from __future__ import annotations
  from typing import List, Tuple, Dict, Optional
  from collections import defaultdict
  import cudf
  from cugraph.utilities.utils import import_optional
  from cugraph_dgl.nn import SparseGraph
label_desc: Use image node_id 7 for calling a global function with example usage: create_homogeneous_sampled_graphs_from_dataframe(sampled_df, edge_dir, return_type) and returns: result_mfgs