code: def _encode_metadata(metadata):
      """Encode metadata dict to UTF-8 JSON string
  
      Parameters
      ----------
      metadata : dict
  
      Returns
      -------
      UTF-8 encoded JSON string
      """
      return json.dumps(metadata).encode("utf-8")
  
imports: from packaging.version import Version
  import json
  import warnings
  import numpy
  from pandas import DataFrame, Series
  from geopandas._compat import import_optional_dependency
  from geopandas.array import from_wkb
  from geopandas import GeoDataFrame
  import geopandas
  from .file import _expand_user
label_desc: Use image node_id 4 for calling a global function with example usage: _encode_metadata(metadata) and returns: json