<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_clock_type(type):
 """ Sets the internal clock type for timing. Profiler shall not have any previous stats. Otherwise an exception is thrown. """

    type = type.upper()
    if type not in CLOCK_TYPES:
        raise YappiError("Invalid clock type:%s" % (type))
        
    _yappi.set_clock_type(CLOCK_TYPES[type])