We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] Class names can be duplicate
**Describe the bug**
Currently, we are able to create multiple classes with an identical name. I think this is undesirable and should be prevented. Might be best to tackle this issue at the same time as #1152.

**Paste the Hedy code & level**
It is super helpful if we can copy-paste the Hedy code to test, so please paste the code here, and don't forget to tell us what level you were in.

**Add a screenshot (optional)**
Make a picture or screenshot to show the issue. Tip! You can make a screenshot and simply paste the image into GitHub with ctrl-v.

**Expected behavior**
A clear and concise description of what you expected to happen.

**What machine and browser you were using (optional)**
If the issue concerns things in the website, let us know:
- What computer you are using (Windows, Mac, Linux?)
- What browser you were using (Chrome, Edge, Safari)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `website/teacher.py`
Content:
```
1 from website.auth import requires_login, is_teacher, current_user
2 import utils
3 import uuid
4 from flask import g, request, jsonify, redirect
5 from flask_helpers import render_template
6 import os
7 import hedyweb
8 TRANSLATIONS = hedyweb.Translations ()
9 from config import config
10 cookie_name     = config ['session'] ['cookie_name']
11 
12 def routes (app, database):
13     global DATABASE
14     DATABASE = database
15 
16     from app import render_main_menu
17 
18     @app.route('/classes', methods=['GET'])
19     @requires_login
20     def get_classes (user):
21         if not is_teacher(user):
22             return 'Only teachers can retrieve classes', 403
23         return jsonify (DATABASE.get_teacher_classes (user ['username'], True))
24 
25     @app.route('/class/<class_id>', methods=['GET'])
26     @requires_login
27     def get_class (user, class_id):
28         if not is_teacher(user):
29             return 'Only teachers can retrieve classes', 403
30         Class = DATABASE.get_class (class_id)
31         if not Class or Class ['teacher'] != user ['username']:
32             return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('no_such_class'))
33         students = []
34         for student_username in Class.get ('students', []):
35             student = DATABASE.user_by_username (student_username)
36             programs = DATABASE.programs_for_user(student_username)
37             highest_level = max(program['level'] for program in programs) if len(programs) else 0
38             sorted_public_programs = list(sorted([program for program in programs if program.get ('public')], key=lambda p: p['date']))
39             if sorted_public_programs:
40                 latest_shared = sorted_public_programs[-1]
41                 latest_shared['link'] = os.getenv ('BASE_URL') + f"/hedy/{latest_shared['id']}/view"
42             else:
43                 latest_shared = None
44             students.append ({'username': student_username, 'last_login': utils.mstoisostring (student ['last_login']), 'programs': len (programs), 'highest_level': highest_level, 'latest_shared': latest_shared})
45 
46         if utils.is_testing_request (request):
47             return jsonify ({'students': students, 'link': Class ['link'], 'name': Class ['name'], 'id': Class ['id']})
48         return render_template ('class-overview.html', auth=TRANSLATIONS.get_translations (g.lang, 'Auth'), menu=render_main_menu('my-profile'), current_page='my-profile', class_info={'students': students, 'link': os.getenv ('BASE_URL') + '/hedy/l/' + Class ['link'], 'name': Class ['name'], 'id': Class ['id']})
49 
50     @app.route('/class', methods=['POST'])
51     @requires_login
52     def create_class (user):
53         if not is_teacher(user):
54             return 'Only teachers can create classes', 403
55 
56         body = request.json
57         # Validations
58         if not isinstance(body, dict):
59             return 'body must be an object', 400
60         if not isinstance(body.get('name'), str):
61             return 'name must be a string', 400
62 
63         Class = {
64             'id': uuid.uuid4().hex,
65             'date': utils.timems (),
66             'teacher': user ['username'],
67             'link': utils.random_id_generator (7),
68             'name': body ['name']
69         }
70 
71         DATABASE.store_class (Class)
72 
73         return {}, 200
74 
75     @app.route('/class/<class_id>', methods=['PUT'])
76     @requires_login
77     def update_class (user, class_id):
78         if not is_teacher(user):
79             return 'Only teachers can update classes', 403
80 
81         body = request.json
82         # Validations
83         if not isinstance(body, dict):
84             return 'body must be an object', 400
85         if not isinstance(body.get('name'), str):
86             return 'name must be a string', 400
87 
88         Class = DATABASE.get_class (class_id)
89         if not Class or Class ['teacher'] != user ['username']:
90             return 'No such class', 404
91 
92         Class = DATABASE.update_class (class_id, body ['name'])
93 
94         return {}, 200
95 
96     @app.route('/class/<class_id>', methods=['DELETE'])
97     @requires_login
98     def delete_class (user, class_id):
99         Class = DATABASE.get_class (class_id)
100         if not Class or Class ['teacher'] != user ['username']:
101             return 'No such class', 404
102 
103         DATABASE.delete_class (Class)
104 
105         return {}, 200
106 
107     @app.route('/class/<class_id>/prejoin/<link>', methods=['GET'])
108     def prejoin_class (class_id, link):
109         Class = DATABASE.get_class (class_id)
110         if not Class or Class ['link'] != link:
111             return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))
112         user = {}
113         if request.cookies.get (cookie_name):
114             token = DATABASE.get_token(request.cookies.get (cookie_name))
115             if token:
116                 if token ['username'] in Class.get ('students', []):
117                     return render_template ('class-already-joined.html', auth=TRANSLATIONS.get_translations (g.lang, 'Auth'), menu=render_main_menu('my-profile'), current_page='my-profile', class_info={'name': Class ['name']})
118                 user = DATABASE.user_by_username(token ['username'])
119 
120         return render_template ('class-prejoin.html',
121             auth=TRANSLATIONS.get_translations (g.lang, 'Auth'),
122             menu=render_main_menu('my-profile'),
123             current_page='my-profile',
124             class_info={
125                 'link': os.getenv ('BASE_URL') + '/class/' + Class ['id'] + '/join/' + Class ['link'] + '?lang=' + g.lang,
126                 'name': Class ['name'],
127             })
128 
129     @app.route('/class/<class_id>/join/<link>', methods=['GET'])
130     @requires_login
131     def join_class (user, class_id, link):
132         Class = DATABASE.get_class (class_id)
133         if not Class or Class ['link'] != link:
134             return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))
135 
136         DATABASE.add_student_to_class (Class ['id'], user ['username'])
137 
138         return redirect(request.url.replace('/class/' + class_id + '/join/' + link, '/my-profile'), code=302)
139 
140     @app.route('/class/<class_id>/student/<student_id>', methods=['DELETE'])
141     @requires_login
142     def leave_class (user, class_id, student_id):
143 
144         Class = DATABASE.get_class (class_id)
145         if not Class or Class ['teacher'] != user ['username']:
146             return 'No such class', 404
147 
148         DATABASE.remove_student_from_class (Class ['id'], student_id)
149 
150         return {}, 200
151 
152     @app.route('/hedy/l/<link_id>', methods=['GET'])
153     def resolve_class_link (link_id):
154         Class = DATABASE.resolve_class_link (link_id)
155         if not Class:
156             return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))
157         return redirect(request.url.replace('/hedy/l/' + link_id, '/class/' + Class ['id'] + '/prejoin/' + link_id), code=302)
158
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/website/teacher.py b/website/teacher.py
--- a/website/teacher.py
+++ b/website/teacher.py
@@ -60,6 +60,12 @@
         if not isinstance(body.get('name'), str):
             return 'name must be a string', 400
 
+        # We use this extra call to verify if the class name doesn't already exist, if so it's a duplicate
+        Classes = DATABASE.get_teacher_classes(user['username'], True)
+        for Class in Classes:
+            if Class['name'] == body['name']:
+                return "duplicate", 200
+
         Class = {
             'id': uuid.uuid4().hex,
             'date': utils.timems (),
@@ -89,6 +95,12 @@
         if not Class or Class ['teacher'] != user ['username']:
             return 'No such class', 404
 
+        # We use this extra call to verify if the class name doesn't already exist, if so it's a duplicate
+        Classes = DATABASE.get_teacher_classes(user ['username'], True)
+        for Class in Classes:
+            if Class['name'] == body['name']:
+                return "duplicate", 200
+
         Class = DATABASE.update_class (class_id, body ['name'])
 
         return {}, 200

{"golden_diff": "diff --git a/website/teacher.py b/website/teacher.py\n--- a/website/teacher.py\n+++ b/website/teacher.py\n@@ -60,6 +60,12 @@\n         if not isinstance(body.get('name'), str):\n             return 'name must be a string', 400\n \n+        # We use this extra call to verify if the class name doesn't already exist, if so it's a duplicate\n+        Classes = DATABASE.get_teacher_classes(user['username'], True)\n+        for Class in Classes:\n+            if Class['name'] == body['name']:\n+                return \"duplicate\", 200\n+\n         Class = {\n             'id': uuid.uuid4().hex,\n             'date': utils.timems (),\n@@ -89,6 +95,12 @@\n         if not Class or Class ['teacher'] != user ['username']:\n             return 'No such class', 404\n \n+        # We use this extra call to verify if the class name doesn't already exist, if so it's a duplicate\n+        Classes = DATABASE.get_teacher_classes(user ['username'], True)\n+        for Class in Classes:\n+            if Class['name'] == body['name']:\n+                return \"duplicate\", 200\n+\n         Class = DATABASE.update_class (class_id, body ['name'])\n \n         return {}, 200\n", "issue": "[BUG] Class names can be duplicate\n**Describe the bug**\r\nCurrently, we are able to create multiple classes with an identical name. I think this is undesirable and should be prevented. Might be best to tackle this issue at the same time as #1152.\r\n\r\n**Paste the Hedy code & level**\r\nIt is super helpful if we can copy-paste the Hedy code to test, so please paste the code here, and don't forget to tell us what level you were in.\r\n\r\n**Add a screenshot (optional)**\r\nMake a picture or screenshot to show the issue. Tip! You can make a screenshot and simply paste the image into GitHub with ctrl-v.\r\n\r\n**Expected behavior**\r\nA clear and concise description of what you expected to happen.\r\n\r\n**What machine and browser you were using (optional)**\r\nIf the issue concerns things in the website, let us know:\r\n- What computer you are using (Windows, Mac, Linux?)\r\n- What browser you were using (Chrome, Edge, Safari)\r\n\n", "before_files": [{"content": "from website.auth import requires_login, is_teacher, current_user\nimport utils\nimport uuid\nfrom flask import g, request, jsonify, redirect\nfrom flask_helpers import render_template\nimport os\nimport hedyweb\nTRANSLATIONS = hedyweb.Translations ()\nfrom config import config\ncookie_name     = config ['session'] ['cookie_name']\n\ndef routes (app, database):\n    global DATABASE\n    DATABASE = database\n\n    from app import render_main_menu\n\n    @app.route('/classes', methods=['GET'])\n    @requires_login\n    def get_classes (user):\n        if not is_teacher(user):\n            return 'Only teachers can retrieve classes', 403\n        return jsonify (DATABASE.get_teacher_classes (user ['username'], True))\n\n    @app.route('/class/<class_id>', methods=['GET'])\n    @requires_login\n    def get_class (user, class_id):\n        if not is_teacher(user):\n            return 'Only teachers can retrieve classes', 403\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['teacher'] != user ['username']:\n            return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('no_such_class'))\n        students = []\n        for student_username in Class.get ('students', []):\n            student = DATABASE.user_by_username (student_username)\n            programs = DATABASE.programs_for_user(student_username)\n            highest_level = max(program['level'] for program in programs) if len(programs) else 0\n            sorted_public_programs = list(sorted([program for program in programs if program.get ('public')], key=lambda p: p['date']))\n            if sorted_public_programs:\n                latest_shared = sorted_public_programs[-1]\n                latest_shared['link'] = os.getenv ('BASE_URL') + f\"/hedy/{latest_shared['id']}/view\"\n            else:\n                latest_shared = None\n            students.append ({'username': student_username, 'last_login': utils.mstoisostring (student ['last_login']), 'programs': len (programs), 'highest_level': highest_level, 'latest_shared': latest_shared})\n\n        if utils.is_testing_request (request):\n            return jsonify ({'students': students, 'link': Class ['link'], 'name': Class ['name'], 'id': Class ['id']})\n        return render_template ('class-overview.html', auth=TRANSLATIONS.get_translations (g.lang, 'Auth'), menu=render_main_menu('my-profile'), current_page='my-profile', class_info={'students': students, 'link': os.getenv ('BASE_URL') + '/hedy/l/' + Class ['link'], 'name': Class ['name'], 'id': Class ['id']})\n\n    @app.route('/class', methods=['POST'])\n    @requires_login\n    def create_class (user):\n        if not is_teacher(user):\n            return 'Only teachers can create classes', 403\n\n        body = request.json\n        # Validations\n        if not isinstance(body, dict):\n            return 'body must be an object', 400\n        if not isinstance(body.get('name'), str):\n            return 'name must be a string', 400\n\n        Class = {\n            'id': uuid.uuid4().hex,\n            'date': utils.timems (),\n            'teacher': user ['username'],\n            'link': utils.random_id_generator (7),\n            'name': body ['name']\n        }\n\n        DATABASE.store_class (Class)\n\n        return {}, 200\n\n    @app.route('/class/<class_id>', methods=['PUT'])\n    @requires_login\n    def update_class (user, class_id):\n        if not is_teacher(user):\n            return 'Only teachers can update classes', 403\n\n        body = request.json\n        # Validations\n        if not isinstance(body, dict):\n            return 'body must be an object', 400\n        if not isinstance(body.get('name'), str):\n            return 'name must be a string', 400\n\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['teacher'] != user ['username']:\n            return 'No such class', 404\n\n        Class = DATABASE.update_class (class_id, body ['name'])\n\n        return {}, 200\n\n    @app.route('/class/<class_id>', methods=['DELETE'])\n    @requires_login\n    def delete_class (user, class_id):\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['teacher'] != user ['username']:\n            return 'No such class', 404\n\n        DATABASE.delete_class (Class)\n\n        return {}, 200\n\n    @app.route('/class/<class_id>/prejoin/<link>', methods=['GET'])\n    def prejoin_class (class_id, link):\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['link'] != link:\n            return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))\n        user = {}\n        if request.cookies.get (cookie_name):\n            token = DATABASE.get_token(request.cookies.get (cookie_name))\n            if token:\n                if token ['username'] in Class.get ('students', []):\n                    return render_template ('class-already-joined.html', auth=TRANSLATIONS.get_translations (g.lang, 'Auth'), menu=render_main_menu('my-profile'), current_page='my-profile', class_info={'name': Class ['name']})\n                user = DATABASE.user_by_username(token ['username'])\n\n        return render_template ('class-prejoin.html',\n            auth=TRANSLATIONS.get_translations (g.lang, 'Auth'),\n            menu=render_main_menu('my-profile'),\n            current_page='my-profile',\n            class_info={\n                'link': os.getenv ('BASE_URL') + '/class/' + Class ['id'] + '/join/' + Class ['link'] + '?lang=' + g.lang,\n                'name': Class ['name'],\n            })\n\n    @app.route('/class/<class_id>/join/<link>', methods=['GET'])\n    @requires_login\n    def join_class (user, class_id, link):\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['link'] != link:\n            return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))\n\n        DATABASE.add_student_to_class (Class ['id'], user ['username'])\n\n        return redirect(request.url.replace('/class/' + class_id + '/join/' + link, '/my-profile'), code=302)\n\n    @app.route('/class/<class_id>/student/<student_id>', methods=['DELETE'])\n    @requires_login\n    def leave_class (user, class_id, student_id):\n\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['teacher'] != user ['username']:\n            return 'No such class', 404\n\n        DATABASE.remove_student_from_class (Class ['id'], student_id)\n\n        return {}, 200\n\n    @app.route('/hedy/l/<link_id>', methods=['GET'])\n    def resolve_class_link (link_id):\n        Class = DATABASE.resolve_class_link (link_id)\n        if not Class:\n            return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))\n        return redirect(request.url.replace('/hedy/l/' + link_id, '/class/' + Class ['id'] + '/prejoin/' + link_id), code=302)\n", "path": "website/teacher.py"}], "after_files": [{"content": "from website.auth import requires_login, is_teacher, current_user\nimport utils\nimport uuid\nfrom flask import g, request, jsonify, redirect\nfrom flask_helpers import render_template\nimport os\nimport hedyweb\nTRANSLATIONS = hedyweb.Translations ()\nfrom config import config\ncookie_name     = config ['session'] ['cookie_name']\n\ndef routes (app, database):\n    global DATABASE\n    DATABASE = database\n\n    from app import render_main_menu\n\n    @app.route('/classes', methods=['GET'])\n    @requires_login\n    def get_classes (user):\n        if not is_teacher(user):\n            return 'Only teachers can retrieve classes', 403\n        return jsonify (DATABASE.get_teacher_classes (user ['username'], True))\n\n    @app.route('/class/<class_id>', methods=['GET'])\n    @requires_login\n    def get_class (user, class_id):\n        if not is_teacher(user):\n            return 'Only teachers can retrieve classes', 403\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['teacher'] != user ['username']:\n            return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('no_such_class'))\n        students = []\n        for student_username in Class.get ('students', []):\n            student = DATABASE.user_by_username (student_username)\n            programs = DATABASE.programs_for_user(student_username)\n            highest_level = max(program['level'] for program in programs) if len(programs) else 0\n            sorted_public_programs = list(sorted([program for program in programs if program.get ('public')], key=lambda p: p['date']))\n            if sorted_public_programs:\n                latest_shared = sorted_public_programs[-1]\n                latest_shared['link'] = os.getenv ('BASE_URL') + f\"/hedy/{latest_shared['id']}/view\"\n            else:\n                latest_shared = None\n            students.append ({'username': student_username, 'last_login': utils.mstoisostring (student ['last_login']), 'programs': len (programs), 'highest_level': highest_level, 'latest_shared': latest_shared})\n\n        if utils.is_testing_request (request):\n            return jsonify ({'students': students, 'link': Class ['link'], 'name': Class ['name'], 'id': Class ['id']})\n        return render_template ('class-overview.html', auth=TRANSLATIONS.get_translations (g.lang, 'Auth'), menu=render_main_menu('my-profile'), current_page='my-profile', class_info={'students': students, 'link': os.getenv ('BASE_URL') + '/hedy/l/' + Class ['link'], 'name': Class ['name'], 'id': Class ['id']})\n\n    @app.route('/class', methods=['POST'])\n    @requires_login\n    def create_class (user):\n        if not is_teacher(user):\n            return 'Only teachers can create classes', 403\n\n        body = request.json\n        # Validations\n        if not isinstance(body, dict):\n            return 'body must be an object', 400\n        if not isinstance(body.get('name'), str):\n            return 'name must be a string', 400\n\n        # We use this extra call to verify if the class name doesn't already exist, if so it's a duplicate\n        Classes = DATABASE.get_teacher_classes(user['username'], True)\n        for Class in Classes:\n            if Class['name'] == body['name']:\n                return \"duplicate\", 200\n\n        Class = {\n            'id': uuid.uuid4().hex,\n            'date': utils.timems (),\n            'teacher': user ['username'],\n            'link': utils.random_id_generator (7),\n            'name': body ['name']\n        }\n\n        DATABASE.store_class (Class)\n\n        return {}, 200\n\n    @app.route('/class/<class_id>', methods=['PUT'])\n    @requires_login\n    def update_class (user, class_id):\n        if not is_teacher(user):\n            return 'Only teachers can update classes', 403\n\n        body = request.json\n        # Validations\n        if not isinstance(body, dict):\n            return 'body must be an object', 400\n        if not isinstance(body.get('name'), str):\n            return 'name must be a string', 400\n\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['teacher'] != user ['username']:\n            return 'No such class', 404\n\n        # We use this extra call to verify if the class name doesn't already exist, if so it's a duplicate\n        Classes = DATABASE.get_teacher_classes(user ['username'], True)\n        for Class in Classes:\n            if Class['name'] == body['name']:\n                return \"duplicate\", 200\n\n        Class = DATABASE.update_class (class_id, body ['name'])\n\n        return {}, 200\n\n    @app.route('/class/<class_id>', methods=['DELETE'])\n    @requires_login\n    def delete_class (user, class_id):\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['teacher'] != user ['username']:\n            return 'No such class', 404\n\n        DATABASE.delete_class (Class)\n\n        return {}, 200\n\n    @app.route('/class/<class_id>/prejoin/<link>', methods=['GET'])\n    def prejoin_class (class_id, link):\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['link'] != link:\n            return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))\n        user = {}\n        if request.cookies.get (cookie_name):\n            token = DATABASE.get_token(request.cookies.get (cookie_name))\n            if token:\n                if token ['username'] in Class.get ('students', []):\n                    return render_template ('class-already-joined.html', auth=TRANSLATIONS.get_translations (g.lang, 'Auth'), menu=render_main_menu('my-profile'), current_page='my-profile', class_info={'name': Class ['name']})\n                user = DATABASE.user_by_username(token ['username'])\n\n        return render_template ('class-prejoin.html',\n            auth=TRANSLATIONS.get_translations (g.lang, 'Auth'),\n            menu=render_main_menu('my-profile'),\n            current_page='my-profile',\n            class_info={\n                'link': os.getenv ('BASE_URL') + '/class/' + Class ['id'] + '/join/' + Class ['link'] + '?lang=' + g.lang,\n                'name': Class ['name'],\n            })\n\n    @app.route('/class/<class_id>/join/<link>', methods=['GET'])\n    @requires_login\n    def join_class (user, class_id, link):\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['link'] != link:\n            return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))\n\n        DATABASE.add_student_to_class (Class ['id'], user ['username'])\n\n        return redirect(request.url.replace('/class/' + class_id + '/join/' + link, '/my-profile'), code=302)\n\n    @app.route('/class/<class_id>/student/<student_id>', methods=['DELETE'])\n    @requires_login\n    def leave_class (user, class_id, student_id):\n\n        Class = DATABASE.get_class (class_id)\n        if not Class or Class ['teacher'] != user ['username']:\n            return 'No such class', 404\n\n        DATABASE.remove_student_from_class (Class ['id'], student_id)\n\n        return {}, 200\n\n    @app.route('/hedy/l/<link_id>', methods=['GET'])\n    def resolve_class_link (link_id):\n        Class = DATABASE.resolve_class_link (link_id)\n        if not Class:\n            return utils.page_404 (TRANSLATIONS, render_main_menu('my-profile'), current_user()['username'], g.lang, TRANSLATIONS.get_translations(g.lang, 'ui').get('invalid_class_link'))\n        return redirect(request.url.replace('/hedy/l/' + link_id, '/class/' + Class ['id'] + '/prejoin/' + link_id), code=302)\n", "path": "website/teacher.py"}]}