def square(self, x):
      if x > 1000:
         ## raise a custom exception
         raise Exception("http://example.com/error#number_too_big",
                         "number %d too big to square" % x)
      return x * x