code: def closest_points(*args):
      """Return the subset of points from a set of points that were
      the closest to each other in the 2D plane.
  
      Parameters
      ==========
  
      args
          A collection of Points on 2D plane.
  
      Notes
      =====
  
      This can only be performed on a set of points whose coordinates can
      be ordered on the number line. If there are no ties then a single
      pair of Points will be in the set.
  
      Examples
      ========
  
      >>> from sympy import closest_points, Triangle
      >>> Triangle(sss=(3, 4, 5)).args
      (Point2D(0, 0), Point2D(3, 0), Point2D(3, 4))
      >>> closest_points(*_)
      {(Point2D(0, 0), Point2D(3, 0))}
  
      References
      ==========
  
      .. [1] https://www.cs.mcgill.ca/~cs251/ClosestPair/ClosestPairPS.html
  
      .. [2] Sweep line algorithm
          https://en.wikipedia.org/wiki/Sweep_line_algorithm
  
      """
      p = [Point2D(i) for i in set(args)]
      if len(p) < 2:
          raise ValueError("At least 2 distinct points must be given.")
  
      try:
          p.sort(key=lambda x: x.args)
      except TypeError:
          raise ValueError("The points could not be sorted.")
  
      if not all(i.is_Rational for j in p for i in j.args):
  
          def hypot(x, y):
              arg = x * x + y * y
              if arg.is_Rational:
                  return _sqrt(arg)
              return sqrt(arg)
  
      else:
          from math import hypot
  
      rv = [(0, 1)]
      best_dist = hypot(p[1].x - p[0].x, p[1].y - p[0].y)
      i = 2
      left = 0
      box = deque([0, 1])
      while i < len(p):
          while left < i and p[i][0] - p[left][0] > best_dist:
              box.popleft()
              left += 1
  
          for j in box:
              d = hypot(p[i].x - p[j].x, p[i].y - p[j].y)
              if d < best_dist:
                  rv = [(j, i)]
              elif d == best_dist:
                  rv.append((j, i))
              else:
                  continue
              best_dist = d
          box.append(i)
          i += 1
  
      return {tuple([p[i] for i in pair]) for pair in rv}
  
imports: from collections import deque
  from math import sqrt
  from sympy import nsimplify
  from .entity import GeometryEntity
  from .exceptions import GeometryError
  from .point import Point, Point2D, Point3D
  from sympy.core.containers import OrderedSet
  from sympy.core.exprtools import factor_terms
  from sympy.core.function import Function, expand_mul
  from sympy.core.numbers import Float
  from sympy.core.sorting import ordered
  from sympy.core.symbol import Symbol
  from sympy.core.singleton import S
  from sympy.polys.polytools import cancel
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.utilities.iterables import is_sequence
  from mpmath.libmp.libmpf import prec_to_dps
label_desc: Use image node_id 6 for calling a global function with example usage: closest_points() and returns: unknown, sqrt, _sqrt