code: def handle_response(response, mode):
      """
      handles the response given by the server according to it's status code
  
      :param response: the format returned from a request
      :param mode: Backtest/ status
      :return: DataFrame/ str
      """
      if response.status_code == 500:
          raise Exception(
              "issues with cloud connections,\n"
              "unable to run catalyst on the cloud,\n"
              "try running again and if you get the same response,\n"
              + EXCEPTION_LOG
          )
      elif response.status_code == 502:
          raise Exception(
              "The server is down at the moment,\n" + EXCEPTION_LOG
          )
      elif response.status_code == 400 or response.status_code == 401:
          raise Exception(
              "There is a connection but it was aborted due "
              "to wrong arguments given to the server.\n"
              + response.content.decode("utf-8")
              + "\n"
              + EXCEPTION_LOG
          )
      elif response.status_code == 202:
          raise Exception(
              "The server is under maintenance. "
              "please try again in a few minutes"
          )
      else:  # if the run was successful
          if mode == BACKTEST:
              algo_id = response.json()["algo_id"]
              log.info(
                  "In order to follow your algo run use the following id: "
                  + algo_id
              )
              return algo_id
          elif mode == STATUS:
              return handle_status(response.json())
  
file_path: catalyst/catalyst/utils/remote.py
imports: import json
  import os
  import sys
  import requests
  from hashlib import md5
  from logbook import Logger
  from catalyst.utils.remote_utils import BACKTEST_PATH, STATUS_PATH, POST, GET, EXCEPTION_LOG, convert_date, prepare_args, handle_status, is_valid_uuid
  from catalyst.exchange.utils.exchange_utils import get_remote_auth, get_remote_folder
  from catalyst.exchange.exchange_errors import RemoteAuthEmpty
label_desc: Use image node_id 1 for calling a global function with example usage: handle_response(response, mode) and returns: algo_id, handle_status