def break_by_timegap(points, timegap=360):
    """Break into trip segments when time recorded between points is
       > timegap variable and group points by segment number in a dictionary"""
    trips = []
    group = 1
    for idx, row in enumerate(points):
        dt = row['timestamp_UTC']
        if idx == 0:
            previous_row = row
            period = 0
        else:
            period = int((dt - previous_row['timestamp_UTC']).total_seconds())
            if period > timegap:
                group += 1
            previous_row = row
        row['segment_group'] = group
        row['break_period'] = period
        row['note'] = ''
        row['merge_codes'] = []
        trips.append(dict(row))
    segment_groups = {}
    for t in trips:
        segment_groups.setdefault(t['segment_group'], []).append(t)
    return segment_groups
