code: def _union_intervals(x, y):
      """Merge two sequences of intervals into a single tuple of intervals.
  
      Any integer bounded by `x` or `y` is also bounded by the result.
  
      >>> _union_intervals([(3, 10)], [(1, 2), (5, 17)])
      ((1, 17),)
      """
      if not x:
          return tuple((u, v) for u, v in y)
      if not y:
          return tuple((u, v) for u, v in x)
      intervals = sorted(x + y, reverse=True)
      result = [intervals.pop()]
      while intervals:
          # 1. intervals is in descending order
          # 2. pop() takes from the RHS.
          # 3. (a, b) was popped 1st, then (u, v) was popped 2nd
          # 4. Therefore: a <= u
          # 5. We assume that u <= v and a <= b
          # 6. So we need to handle 2 cases of overlap, and one disjoint case
          #    |   u--v     |   u----v   |       u--v  |
          #    |   a----b   |   a--b     |  a--b       |
          u, v = intervals.pop()
          a, b = result[-1]
          if u <= b + 1:
              # Overlap cases
              result[-1] = (a, max(v, b))
          else:
              # Disjoint case
              result.append((u, v))
      return tuple(result)
  
file_path: catboost/contrib/python/hypothesis/py2/hypothesis/internal/charmap.py
imports: from __future__ import absolute_import, division, print_function
  import gzip
  import json
  import os
  import sys
  import tempfile
  import unicodedata
  from hypothesis.configuration import mkdir_p, storage_directory
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.compat import hunichr
label_desc: Use image node_id 5 for calling a global function with example usage: _union_intervals(x, y) and returns: tuple, tuple, tuple