def point_is_valid(generator, x, y):
 n = generator.order()
 curve = generator.curve()
 if ((x < 0) or (n <= x) or (y < 0) or (n <= y)):
  return False
 if (not curve.contains_point(x, y)):
  return False
 if (not ((n * ellipticcurve.Point(curve, x, y)) == ellipticcurve.INFINITY)):
  return False
 return True

def point_is_valid ( generator , x , y ) : n = generator . order ( ) curve = generator . curve ( ) if ( ( x < 0 ) or ( n <= x ) or ( y < 0 ) or ( n <= y ) ) : return False if ( not curve . contains_point ( x , y ) ) : return False if ( not ( ( n * ellipticcurve . Point ( curve , x , y ) ) == ellipticcurve . INFINITY ) ) : return False return True
is a valid public key based on the specified generator? .