code: def mention_length(
      name: str,
      query: Optional[str] = None,
      level: str = "token",
      compute_for: Union[str, ComputeFor] = Predictions,
      interval: int = 1,
  ) -> MetricSummary:
      """Computes mentions length distribution (in number of tokens).
  
      Args:
          name: The dataset name.
          query: An ElasticSearch query with the
              `query string syntax <https://docs.argilla.io/en/latest/practical_guides/filter_dataset.html>`_
          level: The mention length level. Accepted values are "token" and "char"
          compute_for: Metric can be computed for annotations or predictions. Accepted values are
              ``Annotations`` and ``Predictions``. Defaults to ``Predictions``.
          interval: The bins or bucket for result histogram
  
      Returns:
          The summary for mention token distribution
  
      Examples:
          >>> from argilla.metrics.token_classification import mention_length
          >>> summary = mention_length(name="example-dataset", interval=2)
          >>> summary.visualize() # will plot a histogram chart with results
          >>> summary.data # the raw histogram data with bins of size 2
      """
      warnings.warn(
          message=_UNUSED_METRIC_WARNING_MESSAGE,
          category=DeprecationWarning,
      )
  
      level = (level or "token").lower().strip()
      accepted_levels = ["token", "char"]
      assert (
          level in accepted_levels
      ), f"Unexpected value for level. Accepted values are {accepted_levels}"
  
      metric = singleton.active_api().compute_metric(
          name,
          metric=f"{_check_compute_for(compute_for)}_mention_{level}_length",
          query=query,
          interval=interval,
      )
  
      return MetricSummary.new_summary(
          data=metric.results,
          visualization=lambda: helpers.histogram(
              metric.results,
              title=metric.description,
              x_legend=f"# {level}",
          ),
      )
  
imports: import warnings
  from enum import Enum
  from typing import Optional, Set, Union
  import deprecated
  from argilla.client import singleton
  from argilla.metrics import helpers
  from argilla.metrics.models import MetricSummary
label_desc: Use image node_id 6 for calling a global function with example usage: mention_length(name, query, level, compute_for, interval) and returns: MetricSummary