code: def _edge_data_to_sframe(data, src_field, dst_field):
      """
      Convert data into an edge data sframe. Using src_field and dst_field to
      identify the source and target id column. The returned sframe will have id
      column name '__src_id', '__dst_id'
      """
      if isinstance(data, SFrame):
          # '__src_vid' and '__dst_vid' already in the sframe, and
          # it is ok to not specify src_field and dst_field
          if (
              src_field is None
              and dst_field is None
              and _SRC_VID_COLUMN in data.column_names()
              and _DST_VID_COLUMN in data.column_names()
          ):
              return data
          if src_field is None:
              raise ValueError(
                  "src_field must be specified for SFrame input"
              )
          if dst_field is None:
              raise ValueError(
                  "dst_field must be specified for SFrame input"
              )
          data_copy = copy.copy(data)
          if (
              src_field == _DST_VID_COLUMN
              and dst_field == _SRC_VID_COLUMN
          ):
              # special case when src_field = "__dst_id" and dst_field = "__src_id"
              # directly renaming will cause name collision
              dst_id_column = data_copy[_DST_VID_COLUMN]
              del data_copy[_DST_VID_COLUMN]
              data_copy.rename(
                  {_SRC_VID_COLUMN: _DST_VID_COLUMN}, inplace=True
              )
              data_copy[_SRC_VID_COLUMN] = dst_id_column
          else:
              data_copy.rename(
                  {
                      src_field: _SRC_VID_COLUMN,
                      dst_field: _DST_VID_COLUMN,
                  },
                  inplace=True,
              )
          return data_copy
  
      elif HAS_PANDAS and type(data) == pd.DataFrame:
          if src_field is None:
              raise ValueError(
                  "src_field must be specified for Pandas input"
              )
          if dst_field is None:
              raise ValueError(
                  "dst_field must be specified for Pandas input"
              )
          sf = SFrame(data)
          if (
              src_field == _DST_VID_COLUMN
              and dst_field == _SRC_VID_COLUMN
          ):
              # special case when src_field = "__dst_id" and dst_field = "__src_id"
              # directly renaming will cause name collision
              dst_id_column = data_copy[_DST_VID_COLUMN]
              del sf[_DST_VID_COLUMN]
              sf.rename(
                  {_SRC_VID_COLUMN: _DST_VID_COLUMN}, inplace=True
              )
              sf[_SRC_VID_COLUMN] = dst_id_column
          else:
              sf.rename(
                  {
                      src_field: _SRC_VID_COLUMN,
                      dst_field: _DST_VID_COLUMN,
                  },
                  inplace=True,
              )
          return sf
  
      elif type(data) == Edge:
          return _edge_list_to_sframe(
              [data], _SRC_VID_COLUMN, _DST_VID_COLUMN
          )
  
      elif type(data) == list:
          return _edge_list_to_sframe(
              data, _SRC_VID_COLUMN, _DST_VID_COLUMN
          )
  
      else:
          raise TypeError(
              "Edges type %s is Not supported." % str(type(data))
          )
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from .._connect import main
  from .sframe import SFrame
  from .sarray import SArray
  from .gframe import GFrame, VERTEX_GFRAME, EDGE_GFRAME
  from .._cython.cy_graph import UnityGraphProxy
  from .._cython.context import debug_trace
  from ..util import _is_non_string_iterable, _make_internal_url
  from .._deps import pandas
  from .._deps import HAS_PANDAS
  import inspect
  import copy
  import sys
label_desc: Use image node_id 9 for calling a global function with example usage: _edge_data_to_sframe(data, src_field, dst_field) and returns: data_copy, data, sf, _edge_list_to_sframe, _edge_list_to_sframe