def t2T(self, seg, t):
self._calc_lengths()<EOL>if isinstance(seg, int):<EOL><INDENT>seg_idx = seg<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>seg_idx = self.index(seg)<EOL><DEDENT>except ValueError:<EOL><INDENT>assert is_path_segment(seg) or isinstance(seg, int)<EOL>raise<EOL><DEDENT><DEDENT>segment_start = sum(self._lengths[:seg_idx])<EOL>segment_end = segment_start + self._lengths[seg_idx]<EOL>T = (segment_end - segment_start)*t + segment_start<EOL>return T<EOL>
returns the path parameter T which corresponds to the segment
        parameter t.  In other words, for any Path object, path, and any
        segment in path, seg,  T(t) = path.t2T(seg, t) is the unique
        reparameterization such that path.point(T(t)) == seg.point(t) for all
        0 <= t <= 1.
        Input Note: seg can be a segment in the Path object or its
        corresponding index.