def add_admin():
    """
    In GET request
        - Displays the add administrator page.
    """
    if request.method == 'GET':
        if 'user' in session:
            is_admin = (requests.get(url='http://127.0.0.1:8080/is-admin/{}'.format(session['user'])).content).decode("utf-8") # Done
            if is_admin == "True":
                add_admin_page = (requests.get(url='http://127.0.0.1:8080/html/{}'.format('add_admin.html')).content).decode("utf-8") # Done
                name_error = request.args.get('name_error', False)
                pass_error = request.args.get('pass_error', False)
                return render_template_string(add_admin_page, nameError = name_error, passError = pass_error)
            else:
                abort(403)
        else:
            return redirect(url_for('login_form'))
    """
    In POST request
        - Checks if the administrator credentials are valid.
        - Checks if the new username is not already taken.
        - Adds the new administrator to the ADMINS table.
    """
    if request.method == 'POST':
        if 'user' in session:
            is_admin = (requests.get(url='http://127.0.0.1:8080/is-admin/{}'.format(session['user'])).content).decode("utf-8") # Done
            if is_admin == "True":
                admin_password = request.form['admin_password']
                new_username = request.form['new_username']
                new_password = request.form['new_password']
                is_valid_admin = (requests.post(url='http://127.0.0.1:8080/is-valid-user', data={'username' : session['user'], 'password' : admin_password}).content).decode("utf-8") # Done
                if is_valid_admin == "True":
                    is_valid_username = (requests.get(url='http://127.0.0.1:8080/is-valid-username/{}'.format(new_username)).content).decode("utf-8") # Done
                    if is_valid_username == "False":
                        requests.post(url='http://127.0.0.1:8080/add-admin', data={'username' : new_username, 'password' : new_password})
                        return redirect(url_for('dashboard'))
                    else:
                        return redirect(url_for('add_admin', name_error = True))
                else:
                    return redirect(url_for('add_admin', pass_error = True))

            else:
                abort(403)
        else:
            return redirect(url_for('login_form'))