<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def make_safe_filename_from_url(self, url):
        '''return a version of url safe for use as a filename'''
        r = re.compile("([^a-zA-Z0-9_.-])")
        filename = r.sub(lambda m : "%" + str(hex(ord(str(m.group(1))))).upper(), url)
        return filename