<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_events(content, start=None, end=None, default_span=timedelta(days=7)):
 """ Query the events occurring in a given time range. :param content: iCal URL/file content as String :param start: start date for search, default today :param end: end date for search :param default_span: default query length (one week) :return: events as list """

    if not start:
        start = now()

    if not end:
        end = start + default_span

    if not content:
        raise ValueError('Content is invalid!')

    calendar = Calendar.from_ical(content)
    
    # Find the calendar's timezone info, or use UTC
    for c in calendar.walk():
        if c.name == 'VTIMEZONE':
            cal_tz = gettz(str(c['TZID']))
            break;
    else:
        cal_tz = UTC

    start = normalize(start, cal_tz)
    end = normalize(end, cal_tz)

    found = []

    for component in calendar.walk():
        if component.name == "VEVENT":
            e = create_event(component)
            if e.recurring:
                # Unfold recurring events according to their rrule
                rule = parse_rrule(component, cal_tz)
                dur = e.end - e.start
                found.extend(e.copy_to(dt) for dt in rule.between(start - dur, end, inc=True))
            elif e.end >= start and e.start <= end:
                found.append(e)
    return found