def cropped(self, T0, T1):
assert <NUM_LIT:0> <= T0 <= <NUM_LIT:1> and <NUM_LIT:0> <= T1<= <NUM_LIT:1><EOL>assert T0 != T1<EOL>assert not (T0 == <NUM_LIT:1> and T1 == <NUM_LIT:0>)<EOL>if T0 == <NUM_LIT:1> and <NUM_LIT:0> < T1 < <NUM_LIT:1> and self.isclosed():<EOL><INDENT>return self.cropped(<NUM_LIT:0>, T1)<EOL><DEDENT>if T1 == <NUM_LIT:1>:<EOL><INDENT>seg1 = self[-<NUM_LIT:1>]<EOL>t_seg1 = <NUM_LIT:1><EOL>i1 = len(self) - <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>seg1_idx, t_seg1 = self.T2t(T1)<EOL>seg1 = self[seg1_idx]<EOL>if np.isclose(t_seg1, <NUM_LIT:0>):<EOL><INDENT>i1 = (self.index(seg1) - <NUM_LIT:1>) % len(self)<EOL>seg1 = self[i1]<EOL>t_seg1 = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>i1 = self.index(seg1)<EOL><DEDENT><DEDENT>if T0 == <NUM_LIT:0>:<EOL><INDENT>seg0 = self[<NUM_LIT:0>]<EOL>t_seg0 = <NUM_LIT:0><EOL>i0 = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>seg0_idx, t_seg0 = self.T2t(T0)<EOL>seg0 = self[seg0_idx]<EOL>if np.isclose(t_seg0, <NUM_LIT:1>):<EOL><INDENT>i0 = (self.index(seg0) + <NUM_LIT:1>) % len(self)<EOL>seg0 = self[i0]<EOL>t_seg0 = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>i0 = self.index(seg0)<EOL><DEDENT><DEDENT>if T0 < T1 and i0 == i1:<EOL><INDENT>new_path = Path(seg0.cropped(t_seg0, t_seg1))<EOL><DEDENT>else:<EOL><INDENT>new_path = Path(seg0.cropped(t_seg0, <NUM_LIT:1>))<EOL>if T1 < T0:<EOL><INDENT>if not self.isclosed():<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>for i in range(i0 + <NUM_LIT:1>, len(self)):<EOL><INDENT>new_path.append(self[i])<EOL><DEDENT>for i in range(<NUM_LIT:0>, i1):<EOL><INDENT>new_path.append(self[i])<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for i in range(i0 + <NUM_LIT:1>, i1):<EOL><INDENT>new_path.append(self[i])<EOL><DEDENT><DEDENT>if t_seg1 != <NUM_LIT:0>:<EOL><INDENT>new_path.append(seg1.cropped(<NUM_LIT:0>, t_seg1))<EOL><DEDENT><DEDENT>return new_path<EOL>
returns a cropped copy of the path.