code: def sec_to_public_pair(sec, generator=None, strict=True):
      
      byte_count = (generator.p().bit_length() + 7) >> 3 if generator else (len(sec) - 1)
      x = from_bytes_32(sec[1:1 + byte_count])
      sec0 = sec[:1]
      if len(sec) == 1 + byte_count * 2:
          isok = sec0 == b'\4'
          if not strict:
              isok = isok or (sec0 in [b'\6', b'\7'])
          if isok:
              y = from_bytes_32(sec[1+byte_count:1+2*byte_count])
              return (x, y)
      elif len(sec) == 1 + byte_count:
          if not strict or (sec0 in (b'\2', b'\3')):
              is_y_odd = (sec0 != b'\2')
              return generator.points_for_x(x)[is_y_odd]
      raise EncodingError("bad sec encoding for public key")
docs: Convert a public key in sec binary format to a public pair.