code: def flatten_edge_dict(
      edge, src_col: str = "src", dst_col: str = "dst"
  ):
      """
      Convert gremlin vertex (in dict form) to flat dict appropriate for pandas
      - Metadata names take priority over property names
      - Remap: T.inV, T.outV -> inV, outV (Neptune)
      - Drop field 'type'
      - src_col and dst_col define output column name for metadata entries
      """
  
      d = {}
      props = {}
      for k in edge.keys():
          if k == "type":
              continue
  
          if k == "inV":
              d[src_col] = edge[k]
              continue
  
          if k == "outV":
              d[dst_col] = edge[k]
              continue
  
          if k == "IN" and isinstance(edge[k], dict):
              d[src_col] = edge[k]["id"]
              continue
  
          if k == "OUT" and isinstance(edge[k], dict):
              d[dst_col] = edge[k]["id"]
              continue
  
          v = edge[k]
          if isinstance(v, list):
              d[str(k)] = v[0]
              continue
  
          if k == "properties" and isinstance(v, dict):
              for prop_k in v:
                  if prop_k == src_col or prop_k == dst_col:
                      continue
                  v2 = v[prop_k]
                  if (
                      isinstance(v2, list)
                      and (len(v2) == 1)
                      and isinstance(v2[0], dict)
                      and "id" in v2[0]
                      and "value" in v2[0]
                  ):
                      props[str(prop_k)] = v2[0]["value"]
                      continue
                  props[str(prop_k)] = str(v2)
              continue
  
          d[str(k)] = edge[k]
  
      if len(props.keys()) > 0:
          d = {**props, **d}
  
      return d
  
imports: from typing import Any, Callable, Iterable, List, Optional, Set, Union, TYPE_CHECKING
  import os, pandas
  from .Plottable import Plottable
  from .util import setup_logger
label_desc: Use image node_id 13 for calling a global function with example usage: flatten_edge_dict(edge, src_col, dst_col) and returns: d