assert number >= 0
result = self._square_root(number)
assert abs(result * result - number) < 0.01
return result

def _square_root(self, number):
    """
        Abstract method for implementing L{square_root()}
        """
raise NotImplementedError()
Using Design by Contract in Python