code: def _tooltip_popup(type, fields, gdf, **kwds):
      """get tooltip or popup"""
      import folium
  
      # specify fields to show in the tooltip
      if fields is False or fields is None or fields == 0:
          return None
      else:
          if fields is True:
              fields = gdf.columns.drop(gdf.geometry.name).to_list()
          elif isinstance(fields, int):
              fields = gdf.columns.drop(gdf.geometry.name).to_list()[
                  :fields
              ]
          elif isinstance(fields, str):
              fields = [fields]
  
      for field in ["__plottable_column", "__folium_color"]:
          if field in fields:
              fields.remove(field)
  
      # Cast fields to str
      fields = list(map(str, fields))
      if type == "tooltip":
          return folium.GeoJsonTooltip(fields, **kwds)
      elif type == "popup":
          return folium.GeoJsonPopup(fields, **kwds)
  
file_path: geopandas/geopandas/explore.py
imports: from statistics import mean
  import geopandas
  from shapely.geometry import LineString
  import numpy
  import pandas
  from packaging.version import Version
label_desc: Use image node_id 2 for calling a global function with example usage: _tooltip_popup(type, fields, gdf) and returns: None, folium, folium