def violationTimeRanges(playerEventList):
    """
    Returns a list of time ranges in which a player was in violation.
    Violations within 10 minutes of each other are considered to be in the
    same time range.
    """
    violationTimes = [ce.time for ce in playerEventList if ce.violation]
    violationTimes.sort()
    if not violationTimes:
        return []
    elif len(violationTimes) == 1:
        return [(violationTimes[0], violationTimes[0])]

    # make a list of lists, each inner list has violation times in the
    # same time range
    violationRanges = [[violationTimes[0]]]
    for t in violationTimes[1:]:
        lastTime = violationRanges[-1][-1]
        if (t - lastTime).total_seconds() <= 60 * 10:
            # add to same time range
            violationRanges[-1].append(t)
        else:
            # begin new time range
            violationRanges.append([t])

    # convert this list of lists to a list of tuples (beginTime, endTime)
    timeRanges = [(t[0], t[-1]) for t in violationRanges]
    return timeRanges