code: def refine_atan2(expr, assumptions):
      """
      Handler for the atan2 function.
  
      Examples
      ========
  
      >>> from sympy import Q, atan2
      >>> from sympy.assumptions.refine import refine_atan2
      >>> from sympy.abc import x, y
      >>> refine_atan2(atan2(y,x), Q.real(y) & Q.positive(x))
      atan(y/x)
      >>> refine_atan2(atan2(y,x), Q.negative(y) & Q.negative(x))
      atan(y/x) - pi
      >>> refine_atan2(atan2(y,x), Q.positive(y) & Q.negative(x))
      atan(y/x) + pi
      >>> refine_atan2(atan2(y,x), Q.zero(y) & Q.negative(x))
      pi
      >>> refine_atan2(atan2(y,x), Q.positive(y) & Q.zero(x))
      pi/2
      >>> refine_atan2(atan2(y,x), Q.negative(y) & Q.zero(x))
      -pi/2
      >>> refine_atan2(atan2(y,x), Q.zero(y) & Q.zero(x))
      nan
      """
      from sympy.functions.elementary.trigonometric import atan
  
      y, x = expr.args
      if ask(Q.real(y) & Q.positive(x), assumptions):
          return atan(y / x)
      elif ask(Q.negative(y) & Q.negative(x), assumptions):
          return atan(y / x) - S.Pi
      elif ask(Q.positive(y) & Q.negative(x), assumptions):
          return atan(y / x) + S.Pi
      elif ask(Q.zero(y) & Q.negative(x), assumptions):
          return S.Pi
      elif ask(Q.positive(y) & Q.zero(x), assumptions):
          return S.Pi / 2
      elif ask(Q.negative(y) & Q.zero(x), assumptions):
          return -S.Pi / 2
      elif ask(Q.zero(y) & Q.zero(x), assumptions):
          return S.NaN
      else:
          return expr
  
file_path: sympy/sympy/assumptions/refine.py
imports: from __future__ import annotations
  from typing import Callable
  from sympy.core import S, Add, Expr, Basic, Mul, Pow, Rational
  from sympy.core.logic import fuzzy_not
  from sympy.logic.boolalg import Boolean
  from sympy.assumptions import ask, Q
label_desc: Use image node_id 4 for calling a global function with example usage: refine_atan2(expr, assumptions) and returns: atan, unknown, unknown, S, unknown, unknown, S, expr