<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def similarity(w1, w2, threshold=0.5):
 """compare two strings 'words', and return ratio of smiliarity, be it larger than the threshold, or 0 otherwise. NOTE: if the result more like junk, increase the threshold value. """

    ratio = SM(None, str(w1).lower(), str(w2).lower()).ratio()
    return ratio if ratio > threshold else 0