code: def _extended_gcd(self, a, b):
          
          s, old_s = 0, 1
          t, old_t = 1, 0
          r, old_r = b, a
          while r:
              quotient = old_r // r
              old_r, r = r, old_r - quotient * r
              old_s, s = s, old_s - quotient * s
              old_t, t = t, old_t - quotient * t
          return old_r, old_s, old_t
docs: Extended Euclidean algorithms to solve Bezout's identity:
             a*x + b*y = gcd(x, y)
          Finds one particular solution for x, y: s, t
          Returns: gcd, s, t