code: def _(a, b):
      # Check that there are no symbolic range arguments
      if not all(all(v.is_number for v in r.args) for r in [a, b]):
          return None
  
      # non-overlap quick exits
      if not b:
          return S.EmptySet
      if not a:
          return S.EmptySet
      if b.sup < a.inf:
          return S.EmptySet
      if b.inf > a.sup:
          return S.EmptySet
  
      # work with finite end at the start
      r1 = a
      if r1.start.is_infinite:
          r1 = r1.reversed
      r2 = b
      if r2.start.is_infinite:
          r2 = r2.reversed
  
      # If both ends are infinite then it means that one Range is just the set
      # of all integers (the step must be 1).
      if r1.start.is_infinite:
          return b
      if r2.start.is_infinite:
          return a
  
      from sympy.solvers.diophantine.diophantine import diop_linear
  
      # this equation represents the values of the Range;
      # it's a linear equation
      eq = lambda r, i: r.start + i * r.step
  
      # we want to know when the two equations might
      # have integer solutions so we use the diophantine
      # solver
      va, vb = diop_linear(eq(r1, Dummy("a")) - eq(r2, Dummy("b")))
  
      # check for no solution
      no_solution = va is None and vb is None
      if no_solution:
          return S.EmptySet
  
      # there is a solution
      # -------------------
  
      # find the coincident point, c
      a0 = va.as_coeff_Add()[0]
      c = eq(r1, a0)
  
      # find the first point, if possible, in each range
      # since c may not be that point
      def _first_finite_point(r1, c):
          if c == r1.start:
              return c
          # st is the signed step we need to take to
          # get from c to r1.start
          st = sign(r1.start - c) * step
          # use Range to calculate the first point:
          # we want to get as close as possible to
          # r1.start; the Range will not be null since
          # it will at least contain c
          s1 = Range(c, r1.start + st, st)[-1]
          if s1 == r1.start:
              pass
          else:
              # if we didn't hit r1.start then, if the
              # sign of st didn't match the sign of r1.step
              # we are off by one and s1 is not in r1
              if sign(r1.step) != sign(st):
                  s1 -= st
          if s1 not in r1:
              return
          return s1
  
      # calculate the step size of the new Range
      step = abs(ilcm(r1.step, r2.step))
      s1 = _first_finite_point(r1, c)
      if s1 is None:
          return S.EmptySet
      s2 = _first_finite_point(r2, c)
      if s2 is None:
          return S.EmptySet
  
      # replace the corresponding start or stop in
      # the original Ranges with these points; the
      # result must have at least one point since
      # we know that s1 and s2 are in the Ranges
      def _updated_range(r, first):
          st = sign(r.step) * step
          if r.start.is_finite:
              rv = Range(first, r.stop, st)
          else:
              rv = Range(r.start, first + st, st)
          return rv
  
      r1 = _updated_range(a, s1)
      r2 = _updated_range(b, s2)
  
      # work with them both in the increasing direction
      if sign(r1.step) < 0:
          r1 = r1.reversed
      if sign(r2.step) < 0:
          r2 = r2.reversed
  
      # return clipped Range with positive step; it
      # can't be empty at this point
      start = max(r1.start, r2.start)
      stop = min(r1.stop, r2.stop)
      return Range(start, stop, step)
  
imports: from sympy.core.basic import _aresame
  from sympy.core.function import Lambda, expand_complex
  from sympy.core.mul import Mul
  from sympy.core.numbers import ilcm, Float
  from sympy.core.relational import Eq
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy, symbols
  from sympy.core.sorting import ordered
  from sympy.functions.elementary.complexes import sign
  from sympy.functions.elementary.integers import floor, ceiling
  from sympy.sets.fancysets import ComplexRegion
  from sympy.sets.sets import FiniteSet, Intersection, Interval, Set, Union
  from sympy.multipledispatch import Dispatcher
  from sympy.sets.conditionset import ConditionSet
  from sympy.sets.fancysets import Integers, Naturals, Reals, Range, ImageSet, Rationals
  from sympy.sets.sets import EmptySet, UniversalSet, imageset, ProductSet
  from sympy.simplify.radsimp import numer
label_desc: Use image node_id 10 for calling a global function with example usage: _(a, b) and returns: Range, None, S, S, S, S, b, a, S, s1, S, S, rv, c