def get_features(waze_info, properties, num_snapshots):
    """
    Given a dict with keys of segment id, and val a list of waze jams
    (for now, just jams), the properties of a road segment, and the
    total number of snapshots we're looking at, update the road segment's
    properties to include features
    Args:
        waze_info - dict
        properties - dict
        num_snapshots
    Returns
        properties
    """
    # Waze feature list
    # jam_percent - percentage of snapshots that have a jam on this segment
    if properties['segment_id'] in waze_info:

        # only count one jam per snapshot on a road
        num_jams = len(set([x['properties']['snapshotId']
                            for x in waze_info[properties['segment_id']]]))
        # The average jam level across all jam instances
        avg_level_when_jammed = round(sum(
            [x['properties']['level']
             for x in waze_info[properties['segment_id']]]
        )/len(waze_info[properties['segment_id']]))
        avg_speed = round(sum(
            [x['properties']['speed']
             for x in waze_info[properties['segment_id']]]
        )/len(waze_info[properties['segment_id']]))
    else:
        num_jams = 0
        avg_speed = 0
        avg_level_when_jammed = 0

    # Turn into number between 0 and 100
    properties.update(jam_percent=100*num_jams/num_snapshots)
    properties.update(jam=1 if num_jams else 0)
    properties.update(avg_jam_speed=avg_speed)
    properties.update(avg_jam_level=avg_level_when_jammed)
    
    return properties