<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_rate(rate):
 """Defines the ideal rate at which computation is to be performed :arg rate: the frequency in Hertz :type rate: int or float :raises: TypeError: if argument 'rate' is not int or float """

    if not (isinstance(rate, int) or isinstance(rate, float)):
        raise TypeError("argument to set_rate is expected to be int or float")
    global loop_duration
    loop_duration = 1.0/rate