code: def convert_edges(
      data,
      *,
      name,
      default_type,
      source_column,
      target_column,
      weight_column,
      type_column,
      nodes,
      dtype,
  ):
      def _node_ids_to_iloc(node_ids):
          try:
              return nodes.ids.to_iloc(node_ids, strict=True)
          except KeyError as e:
              missing_values = e.args[0]
              if not is_real_iterable(missing_values):
                  missing_values = [missing_values]
              missing_values = pd.unique(missing_values)
  
              raise ValueError(
                  f"edges: expected all source and target node IDs to be contained in `nodes`, "
                  f"found some missing: {comma_sep(missing_values)}"
              )
  
      selected = {
          source_column: SOURCE,
          target_column: TARGET,
          weight_column: WEIGHT,
      }
  
      if type_column is not None:
          selected[type_column] = TYPE_ATTR_NAME
  
      converter = ColumnarConverter(
          name,
          default_type,
          type_column=type_column,
          column_defaults={weight_column: DEFAULT_WEIGHT},
          selected_columns=selected,
          transform_columns={
              source_column: _node_ids_to_iloc,
              target_column: _node_ids_to_iloc,
          },
          dtype=dtype,
      )
      ids, columns, type_info = converter.convert(data)
  
      weight_col = columns[WEIGHT]
      if not pd.api.types.is_numeric_dtype(weight_col):
          raise TypeError(
              f"{converter.name()}: expected weight column {weight_column!r} to be numeric, found dtype '{weight_col.dtype}'"
          )
  
      return EdgeData(
          ids,
          columns[SOURCE],
          columns[TARGET],
          weight_col,
          type_info,
          len(nodes),
      )
  
imports: from collections import defaultdict, namedtuple
  from typing import Iterable
  import warnings
  import numpy
  import pandas
  from ..globalvar import SOURCE, TARGET, WEIGHT, TYPE_ATTR_NAME
  from .element_data import NodeData, EdgeData
  from .indexed_array import IndexedArray
  from .validation import comma_sep, require_dataframe_has_columns
  from .utils import is_real_iterable, zero_sized_array, smart_array_concatenate, smart_array_index
label_desc: Use image node_id 2 for calling a global function with example usage: convert_edges(data) and returns: EdgeData, nodes