code: def unify(x, y, s=None, variables=(), **kwargs):
      """Structural unification of two expressions/patterns.
  
      Examples
      ========
  
      >>> from sympy.unify.usympy import unify
      >>> from sympy import Basic, S
      >>> from sympy.abc import x, y, z, p, q
  
      >>> next(unify(Basic(S(1), S(2)), Basic(S(1), x), variables=[x]))
      {x: 2}
  
      >>> expr = 2*x + y + z
      >>> pattern = 2*p + q
      >>> next(unify(expr, pattern, {}, variables=(p, q)))
      {p: x, q: y + z}
  
      Unification supports commutative and associative matching
  
      >>> expr = x + y + z
      >>> pattern = p + q
      >>> len(list(unify(expr, pattern, {}, variables=(p, q))))
      12
  
      Symbols not indicated to be variables are treated as literal,
      else they are wild-like and match anything in a sub-expression.
  
      >>> expr = x*y*z + 3
      >>> pattern = x*y + 3
      >>> next(unify(expr, pattern, {}, variables=[x, y]))
      {x: y, y: x*z}
  
      The x and y of the pattern above were in a Mul and matched factors
      in the Mul of expr. Here, a single symbol matches an entire term:
  
      >>> expr = x*y + 3
      >>> pattern = p + 3
      >>> next(unify(expr, pattern, {}, variables=[p]))
      {p: x*y}
  
      """
      decons = lambda x: deconstruct(x, variables)
      s = s or {}
      s = {decons(k): decons(v) for k, v in s.items()}
  
      ds = core.unify(
          decons(x),
          decons(y),
          s,
          is_associative=is_associative,
          is_commutative=is_commutative,
          **kwargs,
      )
      for d in ds:
          yield {construct(k): construct(v) for k, v in d.items()}
  
file_path: sympy/sympy/unify/usympy.py
imports: from sympy.core import Basic, Add, Mul, Pow
  from sympy.core.operations import AssocOp, LatticeOp
  from sympy.matrices import MatAdd, MatMul, MatrixExpr
  from sympy.sets.sets import Union, Intersection, FiniteSet
  from sympy.unify.core import Compound, Variable, CondVariable
  from sympy.unify import core
label_desc: Use image node_id 9 for calling a global function with example usage: unify(x, y, s, variables) without return types