def repercent_broken_unicode(path):
 try:
  path.decode('utf-8')
 except UnicodeDecodeError as e:
  repercent = quote(path[e.start:e.end], safe="/#%[]=:;$&()+,!?*@'~")
  path = repercent_broken_unicode(((path[:e.start] + force_bytes(repercent)) + path[e.end:]))
 return path

def repercent_broken_unicode ( path ) : try : path . decode ( 'utf-8' ) except UnicodeDecodeError as e : repercent = quote ( path [ e . start : e . end ] , safe = "/#%[]=:;$&()+,!?*@'~" ) path = repercent_broken_unicode ( ( ( path [ : e . start ] + force_bytes ( repercent ) ) + path [ e . end : ] ) ) return path
as per section 3 .