docs: def insert_recording(hw):
      """Insert recording `hw` into database."""
      mysql = utils.get_mysql_cfg()
      connection = pymysql.connect(host=mysql['host'],
                                   user=mysql['user'],
                                   passwd=mysql['passwd'],
                                   db=mysql['db'],
                                   charset='utf8mb4',
                                   cursorclass=pymysql.cursors.DictCursor)
      try:
          cursor = connection.cursor()
          sql = ("INSERT INTO `wm_raw_draw_data` ("
                 "`user_id`, "
                 "`data`, "
                 "`md5data`, "
                 "`creation_date`, "
                 "`device_type`, "
                 "`accepted_formula_id`, "
                 "`secret`, "
                 "`ip`, "
                 "`segmentation`, "
                 "`internal_id`, "
                 "`description` "
                 ") VALUES (%s, %s, MD5(data), "
                 "%s, %s, %s, %s, %s, %s, %s, %s);")
          data = (hw.user_id,
                  hw.raw_data_json,
                  getattr(hw, 'creation_date', None),
                  getattr(hw, 'device_type', ''),
                  getattr(hw, 'formula_id', None),
                  getattr(hw, 'secret', ''),
                  getattr(hw, 'ip', None),
                  str(getattr(hw, 'segmentation', '')),
                  getattr(hw, 'internal_id', ''),
                  getattr(hw, 'description', ''))
          cursor.execute(sql, data)
          connection.commit()
          for symbol_id, strokes in zip(hw.symbol_stream, hw.segmentation):
              insert_symbol_mapping(cursor.lastrowid,
                                    symbol_id,
                                    hw.user_id,
                                    strokes)
          logging.info("Insert raw data.")
      except pymysql.err.IntegrityError as e:
          print("Error: {} (can probably be ignored)".format(e))