Fetch data from the server.

    Parameters
    ----------
    top_n : int
        Number of data sets which get fetched from the server.

def get_segmented_raw_data(top_n=10000):
    """Fetch data from the server.

    Parameters
    ----------
    top_n : int
        Number of data sets which get fetched from the server.
    """
    cfg = utils.get_database_configuration()
    mysql = cfg['mysql_online']
    connection = pymysql.connect(host=mysql['host'],
                                 user=mysql['user'],
                                 passwd=mysql['passwd'],
                                 db=mysql['db'],
                                 cursorclass=pymysql.cursors.DictCursor)
    cursor = connection.cursor()
    sql = ("SELECT `id`, `data`, `segmentation` "
           "FROM `wm_raw_draw_data` WHERE "
           "(`segmentation` IS NOT NULL OR `accepted_formula_id` IS NOT NULL) "
           "AND `wild_point_count` = 0 "
           "AND `stroke_segmentable` = 1 "
           "ORDER BY `id` LIMIT 0, %i") % top_n
    logging.info(sql)
    cursor.execute(sql)
    datasets = cursor.fetchall()
    logging.info("Fetched %i recordings. Add missing segmentations.",
                 len(datasets))
    for i in range(len(datasets)):
        if datasets[i]['segmentation'] is None:
            stroke_count = len(json.loads(datasets[i]['data']))
            if stroke_count > 10:
                print("Massive stroke count! %i" % stroke_count)
            datasets[i]['segmentation'] = str([[s for s in
                                                range(stroke_count)]])
    return datasets