code: def pop_legend_kwarg(kwargs):
      result = {
          attr: kwargs.pop(attr)
          for attr in LEGEND_ARGS
          if attr in kwargs
      }
      if len(result) > 1:
          raise ValueError(
              f"Only one of {nice_join(LEGEND_ARGS)} may be provided, got: {nice_join(result.keys())}"
          )
      return result
  
file_path: bokeh/src/bokeh/plotting/_legends.py
imports: from __future__ import annotations
  import logging
  import numpy
  from ..core.properties import field, value
  from ..models import Legend, LegendItem
  from ..util.strings import nice_join
label_desc: Use image node_id 1 for calling a global function with example usage: pop_legend_kwarg(kwargs) and returns: result