code: def flatten_vertex_dict(
      vertex: dict, id_col: str = "id", label_col: str = "label"
  ) -> dict:
      """
      Convert gremlin vertex (in dict form) to flat dict appropriate for pandas
      - Metadata names take priority over property names
      - Remap: T.id, T.label -> id, label (Neptune)
      - Drop field 'type'
      - id_col and label_col define output column name for metadata entries
      """
  
      d = {}
      props = {}
      for k in vertex.keys():
          if k == "type":
              continue
  
          if k == "id" or k == "T.id":
              d[id_col] = vertex[k]
              continue
  
          if k == "label" or k == "T.label":
              d[label_col] = vertex[label_col]
              continue
  
          v = vertex[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 == id_col:
                      continue
                  v2 = v[prop_k]
                  # TODO: multi-prop to list?
                  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)] = vertex[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 7 for calling a global function with example usage: flatten_vertex_dict(vertex, id_col, label_col) and returns: d