code: def deduplicate_overlapping_entities(entities):
      """Deduplicates entities based on overlapping ranges"""
  
      def overlap(lhs_entity, rhs_entity):
          return ranges_overlap(
              lhs_entity[RES_MATCH_RANGE], rhs_entity[RES_MATCH_RANGE]
          )
  
      def sort_key_fn(entity):
          return -len(entity[RES_VALUE])
  
      deduplicated_entities = deduplicate_overlapping_items(
          entities, overlap, sort_key_fn
      )
      return sorted(
          deduplicated_entities,
          key=lambda entity: entity[RES_MATCH_RANGE][START],
      )
  
imports: from __future__ import unicode_literals
  import importlib
  import json
  import numbers
  import re
  from builtins import bytes, str
  from datetime import datetime
  from functools import wraps
  from pathlib import Path
  from future.utils import text_type
  from snips_nlu.constants import END, ENTITY_KIND, RES_MATCH_RANGE, RES_VALUE, START
  from snips_nlu.exceptions import NotTrained, PersistingError
label_desc: Use image node_id 14 for calling a global function with example usage: deduplicate_overlapping_entities(entities) and returns: sorted, ranges_overlap, unknown