docs: def upload_runsummary(csv_filename, dryrun=False):
      """Reads the CSV file and uploads its contents to the runsummary table"""
      print("Checking '{}' for consistency.".format(csv_filename))
      if not os.path.exists(csv_filename):
          log.critical("{} -> file not found.".format(csv_filename))
          return
      try:
          df = pd.read_csv(csv_filename, sep='\t')
      except pd.errors.EmptyDataError as e:
          log.error(e)
          return
  
      cols = set(df.columns)
  
      if not REQUIRED_COLUMNS.issubset(cols):
          log.error(
              "Missing columns: {}.".format(
                  ', '.join(str(c) for c in REQUIRED_COLUMNS - cols)
              )
          )
          return
  
      parameters = cols - REQUIRED_COLUMNS
      if len(parameters) < 1:
          log.error("No parameter columns found.")
          return
  
      if len(df) == 0:
          log.critical("Empty dataset.")
          return
  
      print(
          "Found data for parameters: {}.".format(
              ', '.join(str(c) for c in parameters)
          )
      )
      print("Converting CSV data into JSON")
      if dryrun:
          log.warn("Dryrun: adding 'TEST_' prefix to parameter names")
          prefix = "TEST_"
      else:
          prefix = ""
      data = convert_runsummary_to_json(df, prefix=prefix)
      print("We have {:.3f} MB to upload.".format(len(data) / 1024**2))
  
      print("Requesting database session.")
      db = kp.db.DBManager()    # noqa
      if kp.db.we_are_in_lyon():
          session_cookie = "sid=_kmcprod_134.158_lyo7783844001343100343mcprod1223user"    # noqa
      else:
          session_cookie = kp.config.Config().get('DB', 'session_cookie')
          if session_cookie is None:
              raise SystemExit("Could not restore DB session.")
      log.debug("Using the session cookie: {}".format(session_cookie))
      cookie_key, sid = session_cookie.split('=')
      print("Uploading the data to the database.")
      r = requests.post(
          RUNSUMMARY_URL, cookies={cookie_key: sid}, files={'datafile': data}
      )
      if r.status_code == 200:
          log.debug("POST request status code: {}".format(r.status_code))
          print("Database response:")
          db_answer = json.loads(r.text)
          for key, value in db_answer.items():
              print("  -> {}: {}".format(key, value))
          if db_answer['Result'] == 'OK':
              print("Upload successful.")
          else:
              log.critical("Something went wrong.")
      else:
          log.error("POST request status code: {}".format(r.status_code))
          log.critical("Something went wrong...")
          return