<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_segwizard(source, gpstype=LIGOTimeGPS, strict=True):
 """Read segments from a segwizard format file into a `SegmentList` Parameters source : `file`, `str` An open file, or file path, from which to read gpstype : `type`, optional The numeric type to which to cast times (from `str`) when reading. strict : `bool`, optional Check that recorded duration matches ``end-start`` for all segments; only used when reading from a 3+-column file. Returns ------- segments : `~gwpy.segments.SegmentList` The list of segments as parsed from the file. Notes ----- This method is adapted from original code written by Kipp Cannon and distributed under GPLv3. """

    # read file path
    if isinstance(source, string_types):
        with open(source, 'r') as fobj:
            return from_segwizard(fobj, gpstype=gpstype, strict=strict)

    # read file object
    out = SegmentList()
    fmt_pat = None
    for line in source:
        if line.startswith(('#', ';')):  # comment
            continue
        # determine line format
        if fmt_pat is None:
            fmt_pat = _line_format(line)
        # parse line
        tokens, = fmt_pat.findall(line)
        out.append(_format_segment(tokens[-3:], gpstype=gpstype,
                                   strict=strict))
    return out