def smoothed_path(path, maxjointsize=<NUM_LIT:3>, tightness=<NUM_LIT>, ignore_unfixable_kinks=False):
if len(path) == <NUM_LIT:1>:<EOL><INDENT>return path<EOL><DEDENT>assert path.iscontinuous()<EOL>sharp_kinks = []<EOL>new_path = [path[<NUM_LIT:0>]]<EOL>for idx in range(len(path)):<EOL><INDENT>if idx == len(path)-<NUM_LIT:1>:<EOL><INDENT>if not path.isclosed():<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>seg1 = new_path[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>seg1 = path[idx + <NUM_LIT:1>]<EOL><DEDENT>seg0 = new_path[-<NUM_LIT:1>]<EOL>try:<EOL><INDENT>unit_tangent0 = seg0.unit_tangent(<NUM_LIT:1>)<EOL>unit_tangent1 = seg1.unit_tangent(<NUM_LIT:0>)<EOL>flag = False<EOL><DEDENT>except ValueError:<EOL><INDENT>flag = True  <EOL><DEDENT>if not flag and isclose(unit_tangent0, unit_tangent1):  <EOL><INDENT>if idx != len(path)-<NUM_LIT:1>:<EOL><INDENT>new_path.append(seg1)<EOL><DEDENT>continue<EOL><DEDENT>else:<EOL><INDENT>kink_idx = (idx + <NUM_LIT:1>) % len(path)  <EOL>if not flag and isclose(-unit_tangent0, unit_tangent1):<EOL><INDENT>new_path.append(seg1)<EOL>sharp_kinks.append(kink_idx)<EOL><DEDENT>else:  <EOL><INDENT>args = (seg0, seg1, maxjointsize, tightness)<EOL>new_seg0, elbow_segs, new_seg1 = smoothed_joint(*args)<EOL>new_path[-<NUM_LIT:1>] = new_seg0<EOL>new_path += elbow_segs<EOL>if idx == len(path) - <NUM_LIT:1>:<EOL><INDENT>new_path[<NUM_LIT:0>] = new_seg1<EOL><DEDENT>else:<EOL><INDENT>new_path.append(new_seg1)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if sharp_kinks and not ignore_unfixable_kinks:<EOL><INDENT>_report_unfixable_kinks(path, sharp_kinks)<EOL><DEDENT>return Path(*new_path)<EOL>
returns a path with no non-differentiable joints.