<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getAngle(self, mode='deg'):
 """ return bend angle :param mode: 'deg' or 'rad' :return: deflecting angle in RAD """

        if self.refresh is True:
            self.getMatrix()

        try:
            if self.mflag:
                if mode == 'deg':
                    return self.bangle / np.pi * 180
                else:  # rad
                    return self.bangle
            else:
                return 0
        except AttributeError:
            print("Please execute getMatrix() first.")