code: def sec_to_public_pair(pubkey):
      
      x = string_to_number(pubkey[1:33])
      sec0 = pubkey[:1]
      if sec0 not in (b'\2', b'\3'):
          raise Exception("Compressed pubkey expected")
  
      def public_pair_for_x(generator, x, is_even):
          curve = generator.curve()
          p = curve.p()
          alpha = (pow(x, 3, p) + curve.a() * x + curve.b()) % p
          beta = ecdsa.numbertheory.square_root_mod_prime(alpha, p)
          if is_even == bool(beta & 1):
              return (x, p - beta)
          return (x, beta)
  
      return public_pair_for_x(ecdsa.ecdsa.generator_secp256k1, x, is_even=(sec0 == b'\2'))
docs: Convert a public key in sec binary format to a public pair.