We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Sort EMR versions naturally
The EMR versions are currently not sorted naturally but by alphabet, which breaks for example with EMR 5.11.0.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `atmo/clusters/queries.py`
Content:
```
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, you can obtain one at http://mozilla.org/MPL/2.0/.
4 from django.db import models
5 
6 
7 class EMRReleaseQuerySet(models.QuerySet):
8     """
9     A Django queryset for the :class:`~atmo.clusters.models.EMRRelease` model.
10     """
11 
12     def active(self):
13         return self.filter(
14             is_active=True,
15         )
16 
17     def stable(self):
18         """
19         The EMR releases that are considered stable.
20         """
21         return self.filter(
22             is_experimental=False,
23             is_deprecated=False,
24             is_active=True,
25         )
26 
27     def experimental(self):
28         """
29         The EMR releases that are considered experimental.
30         """
31         return self.filter(
32             is_experimental=True,
33             is_active=True,
34         )
35 
36     def deprecated(self):
37         """
38         The EMR releases that are deprecated.
39         """
40         return self.filter(
41             is_deprecated=True,
42             is_active=True,
43         )
44 
45 
46 class ClusterQuerySet(models.QuerySet):
47     """A Django queryset that filters by cluster status.
48 
49     Used by the :class:`~atmo.clusters.models.Cluster` model.
50     """
51 
52     def active(self):
53         """
54         The clusters that have an active status.
55         """
56         return self.filter(
57             most_recent_status__in=self.model.ACTIVE_STATUS_LIST,
58         )
59 
60     def terminated(self):
61         """
62         The clusters that have an terminated status.
63         """
64         return self.filter(
65             most_recent_status__in=self.model.TERMINATED_STATUS_LIST,
66         )
67 
68     def failed(self):
69         """
70         The clusters that have an failed status.
71         """
72         return self.filter(
73             most_recent_status__in=self.model.FAILED_STATUS_LIST,
74         )
75
```

Path: `atmo/clusters/forms.py`
Content:
```
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, you can obtain one at http://mozilla.org/MPL/2.0/.
4 from django import forms
5 from django.conf import settings
6 from django.core.urlresolvers import reverse
7 from django.utils.safestring import mark_safe
8 
9 from . import models
10 from ..forms.mixins import AutoClassFormMixin, CreatedByModelFormMixin
11 from ..keys.models import SSHKey
12 
13 
14 class EMRReleaseChoiceField(forms.ModelChoiceField):
15     """
16     A :class:`~django.forms.ModelChoiceField` subclass that uses
17     :class:`~atmo.clusters.models.EMRRelease` objects for the choices
18     and automatically uses a "radioset" rendering -- a horizontal button
19     group for easier selection.
20     """
21     def __init__(self, *args, **kwargs):
22         super().__init__(
23             label='EMR release',
24             queryset=models.EMRRelease.objects.active(),
25             required=True,
26             empty_label=None,
27             widget=forms.RadioSelect(attrs={
28                 'required': 'required',
29                 'class': 'radioset',
30             }),
31             help_text=models.Cluster.EMR_RELEASE_HELP,
32         )
33 
34     def label_from_instance(self, obj):
35         """
36         Append the status of the EMR release if it's
37         experimental or deprecated.
38         """
39         label = obj.version
40         extra = []
41         if obj.is_experimental:
42             extra.append('<span class="label label-info">experimental</span>')
43         elif obj.is_deprecated:
44             extra.append('<span class="label label-warning">deprecated</span>')
45         if extra:
46             label = mark_safe('%s %s' % (label, ''.join(extra)))
47         return label
48 
49 
50 class NewClusterForm(AutoClassFormMixin, CreatedByModelFormMixin,
51                      forms.ModelForm):
52     """
53     A form used for creating new clusters.
54     """
55     prefix = 'new'
56 
57     identifier = forms.RegexField(
58         required=True,
59         label='Identifier',
60         regex=r'^[a-z0-9-]{1,100}$',
61         widget=forms.TextInput(attrs={
62             'pattern': r'[a-z0-9-]{1,100}',
63             'data-parsley-pattern-message': 'Identifier contains invalid characters.',
64         }),
65         help_text='A unique identifier for your cluster, visible in '
66                   'the AWS management console. (Lowercase, use hyphens '
67                   'instead of spaces.)'
68     )
69     size = forms.IntegerField(
70         label='Size',
71         required=True,
72         min_value=1,
73         max_value=settings.AWS_CONFIG['MAX_CLUSTER_SIZE'],
74         widget=forms.NumberInput(attrs={
75             'min': '1',
76             'max': str(settings.AWS_CONFIG['MAX_CLUSTER_SIZE']),
77         }),
78         help_text=('Number of workers to use in the cluster, between 1 and %s. '
79                    'For testing or development 1 is recommended.' %
80                    settings.AWS_CONFIG['MAX_CLUSTER_SIZE'])
81     )
82     lifetime = forms.IntegerField(
83         label='Lifetime',
84         required=True,
85         min_value=2,
86         max_value=settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'],
87         widget=forms.NumberInput(attrs={
88             'min': '2',
89             'max': str(settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME']),
90         }),
91         help_text=('Lifetime in hours after which the cluster is automatically '
92                    'terminated, between 2 and %s.' %
93                    settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'])
94     )
95     ssh_key = forms.ModelChoiceField(
96         label='SSH key',
97         queryset=SSHKey.objects.all(),
98         required=True,
99         empty_label=None,
100     )
101     emr_release = EMRReleaseChoiceField()
102 
103     class Meta:
104         model = models.Cluster
105         fields = ['identifier', 'size', 'lifetime', 'ssh_key', 'emr_release']
106 
107     def __init__(self, *args, **kwargs):
108         super().__init__(*args, **kwargs)
109         user_sshkeys = self.created_by.created_sshkeys.all()
110         self.fields['ssh_key'].queryset = user_sshkeys.all()
111         self.fields['ssh_key'].help_text = (
112             'The SSH key to deploy to the cluster. '
113             'See <a href="%s">your keys</a> or '
114             '<a href="%s">add a new one</a>.' %
115             (reverse('keys-list'), reverse('keys-new'))
116         )
117         # if there are fewer options we just show radio select buttons
118         if user_sshkeys.count() <= 6:
119             self.fields['ssh_key'].widget = forms.RadioSelect(
120                 choices=self.fields['ssh_key'].choices,
121                 attrs={
122                     'class': 'radioset',
123                 },
124             )
125 
126 
127 class ExtendClusterForm(AutoClassFormMixin, forms.Form):
128     prefix = 'extend'
129     extension = forms.IntegerField(
130         label='Lifetime extension in hours',
131         required=True,
132         min_value=2,
133         max_value=settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'],
134         widget=forms.NumberInput(attrs={
135             'min': '2',
136             'max': str(settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME']),
137         }),
138         help_text=("Number of hours to extend the cluster's lifetime with, between 2 and %s." %
139                    settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'])
140     )
141
```
--- 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/atmo/clusters/forms.py b/atmo/clusters/forms.py
--- a/atmo/clusters/forms.py
+++ b/atmo/clusters/forms.py
@@ -21,7 +21,7 @@
     def __init__(self, *args, **kwargs):
         super().__init__(
             label='EMR release',
-            queryset=models.EMRRelease.objects.active(),
+            queryset=models.EMRRelease.objects.active().natural_sort_by_version(),
             required=True,
             empty_label=None,
             widget=forms.RadioSelect(attrs={
diff --git a/atmo/clusters/queries.py b/atmo/clusters/queries.py
--- a/atmo/clusters/queries.py
+++ b/atmo/clusters/queries.py
@@ -8,6 +8,15 @@
     """
     A Django queryset for the :class:`~atmo.clusters.models.EMRRelease` model.
     """
+    def natural_sort_by_version(self):
+        """
+        Sorts this queryset by the EMR version naturally (human-readable).
+        """
+        return self.extra(
+            select={
+                'natural_version': "string_to_array(version, '.')::int[]",
+            },
+        ).order_by('-natural_version')
 
     def active(self):
         return self.filter(

{"golden_diff": "diff --git a/atmo/clusters/forms.py b/atmo/clusters/forms.py\n--- a/atmo/clusters/forms.py\n+++ b/atmo/clusters/forms.py\n@@ -21,7 +21,7 @@\n     def __init__(self, *args, **kwargs):\n         super().__init__(\n             label='EMR release',\n-            queryset=models.EMRRelease.objects.active(),\n+            queryset=models.EMRRelease.objects.active().natural_sort_by_version(),\n             required=True,\n             empty_label=None,\n             widget=forms.RadioSelect(attrs={\ndiff --git a/atmo/clusters/queries.py b/atmo/clusters/queries.py\n--- a/atmo/clusters/queries.py\n+++ b/atmo/clusters/queries.py\n@@ -8,6 +8,15 @@\n     \"\"\"\n     A Django queryset for the :class:`~atmo.clusters.models.EMRRelease` model.\n     \"\"\"\n+    def natural_sort_by_version(self):\n+        \"\"\"\n+        Sorts this queryset by the EMR version naturally (human-readable).\n+        \"\"\"\n+        return self.extra(\n+            select={\n+                'natural_version': \"string_to_array(version, '.')::int[]\",\n+            },\n+        ).order_by('-natural_version')\n \n     def active(self):\n         return self.filter(\n", "issue": "Sort EMR versions naturally\nThe EMR versions are currently not sorted naturally but by alphabet, which breaks for example with EMR 5.11.0.\n", "before_files": [{"content": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, you can obtain one at http://mozilla.org/MPL/2.0/.\nfrom django.db import models\n\n\nclass EMRReleaseQuerySet(models.QuerySet):\n    \"\"\"\n    A Django queryset for the :class:`~atmo.clusters.models.EMRRelease` model.\n    \"\"\"\n\n    def active(self):\n        return self.filter(\n            is_active=True,\n        )\n\n    def stable(self):\n        \"\"\"\n        The EMR releases that are considered stable.\n        \"\"\"\n        return self.filter(\n            is_experimental=False,\n            is_deprecated=False,\n            is_active=True,\n        )\n\n    def experimental(self):\n        \"\"\"\n        The EMR releases that are considered experimental.\n        \"\"\"\n        return self.filter(\n            is_experimental=True,\n            is_active=True,\n        )\n\n    def deprecated(self):\n        \"\"\"\n        The EMR releases that are deprecated.\n        \"\"\"\n        return self.filter(\n            is_deprecated=True,\n            is_active=True,\n        )\n\n\nclass ClusterQuerySet(models.QuerySet):\n    \"\"\"A Django queryset that filters by cluster status.\n\n    Used by the :class:`~atmo.clusters.models.Cluster` model.\n    \"\"\"\n\n    def active(self):\n        \"\"\"\n        The clusters that have an active status.\n        \"\"\"\n        return self.filter(\n            most_recent_status__in=self.model.ACTIVE_STATUS_LIST,\n        )\n\n    def terminated(self):\n        \"\"\"\n        The clusters that have an terminated status.\n        \"\"\"\n        return self.filter(\n            most_recent_status__in=self.model.TERMINATED_STATUS_LIST,\n        )\n\n    def failed(self):\n        \"\"\"\n        The clusters that have an failed status.\n        \"\"\"\n        return self.filter(\n            most_recent_status__in=self.model.FAILED_STATUS_LIST,\n        )\n", "path": "atmo/clusters/queries.py"}, {"content": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, you can obtain one at http://mozilla.org/MPL/2.0/.\nfrom django import forms\nfrom django.conf import settings\nfrom django.core.urlresolvers import reverse\nfrom django.utils.safestring import mark_safe\n\nfrom . import models\nfrom ..forms.mixins import AutoClassFormMixin, CreatedByModelFormMixin\nfrom ..keys.models import SSHKey\n\n\nclass EMRReleaseChoiceField(forms.ModelChoiceField):\n    \"\"\"\n    A :class:`~django.forms.ModelChoiceField` subclass that uses\n    :class:`~atmo.clusters.models.EMRRelease` objects for the choices\n    and automatically uses a \"radioset\" rendering -- a horizontal button\n    group for easier selection.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        super().__init__(\n            label='EMR release',\n            queryset=models.EMRRelease.objects.active(),\n            required=True,\n            empty_label=None,\n            widget=forms.RadioSelect(attrs={\n                'required': 'required',\n                'class': 'radioset',\n            }),\n            help_text=models.Cluster.EMR_RELEASE_HELP,\n        )\n\n    def label_from_instance(self, obj):\n        \"\"\"\n        Append the status of the EMR release if it's\n        experimental or deprecated.\n        \"\"\"\n        label = obj.version\n        extra = []\n        if obj.is_experimental:\n            extra.append('<span class=\"label label-info\">experimental</span>')\n        elif obj.is_deprecated:\n            extra.append('<span class=\"label label-warning\">deprecated</span>')\n        if extra:\n            label = mark_safe('%s %s' % (label, ''.join(extra)))\n        return label\n\n\nclass NewClusterForm(AutoClassFormMixin, CreatedByModelFormMixin,\n                     forms.ModelForm):\n    \"\"\"\n    A form used for creating new clusters.\n    \"\"\"\n    prefix = 'new'\n\n    identifier = forms.RegexField(\n        required=True,\n        label='Identifier',\n        regex=r'^[a-z0-9-]{1,100}$',\n        widget=forms.TextInput(attrs={\n            'pattern': r'[a-z0-9-]{1,100}',\n            'data-parsley-pattern-message': 'Identifier contains invalid characters.',\n        }),\n        help_text='A unique identifier for your cluster, visible in '\n                  'the AWS management console. (Lowercase, use hyphens '\n                  'instead of spaces.)'\n    )\n    size = forms.IntegerField(\n        label='Size',\n        required=True,\n        min_value=1,\n        max_value=settings.AWS_CONFIG['MAX_CLUSTER_SIZE'],\n        widget=forms.NumberInput(attrs={\n            'min': '1',\n            'max': str(settings.AWS_CONFIG['MAX_CLUSTER_SIZE']),\n        }),\n        help_text=('Number of workers to use in the cluster, between 1 and %s. '\n                   'For testing or development 1 is recommended.' %\n                   settings.AWS_CONFIG['MAX_CLUSTER_SIZE'])\n    )\n    lifetime = forms.IntegerField(\n        label='Lifetime',\n        required=True,\n        min_value=2,\n        max_value=settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'],\n        widget=forms.NumberInput(attrs={\n            'min': '2',\n            'max': str(settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME']),\n        }),\n        help_text=('Lifetime in hours after which the cluster is automatically '\n                   'terminated, between 2 and %s.' %\n                   settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'])\n    )\n    ssh_key = forms.ModelChoiceField(\n        label='SSH key',\n        queryset=SSHKey.objects.all(),\n        required=True,\n        empty_label=None,\n    )\n    emr_release = EMRReleaseChoiceField()\n\n    class Meta:\n        model = models.Cluster\n        fields = ['identifier', 'size', 'lifetime', 'ssh_key', 'emr_release']\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        user_sshkeys = self.created_by.created_sshkeys.all()\n        self.fields['ssh_key'].queryset = user_sshkeys.all()\n        self.fields['ssh_key'].help_text = (\n            'The SSH key to deploy to the cluster. '\n            'See <a href=\"%s\">your keys</a> or '\n            '<a href=\"%s\">add a new one</a>.' %\n            (reverse('keys-list'), reverse('keys-new'))\n        )\n        # if there are fewer options we just show radio select buttons\n        if user_sshkeys.count() <= 6:\n            self.fields['ssh_key'].widget = forms.RadioSelect(\n                choices=self.fields['ssh_key'].choices,\n                attrs={\n                    'class': 'radioset',\n                },\n            )\n\n\nclass ExtendClusterForm(AutoClassFormMixin, forms.Form):\n    prefix = 'extend'\n    extension = forms.IntegerField(\n        label='Lifetime extension in hours',\n        required=True,\n        min_value=2,\n        max_value=settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'],\n        widget=forms.NumberInput(attrs={\n            'min': '2',\n            'max': str(settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME']),\n        }),\n        help_text=(\"Number of hours to extend the cluster's lifetime with, between 2 and %s.\" %\n                   settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'])\n    )\n", "path": "atmo/clusters/forms.py"}], "after_files": [{"content": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, you can obtain one at http://mozilla.org/MPL/2.0/.\nfrom django.db import models\n\n\nclass EMRReleaseQuerySet(models.QuerySet):\n    \"\"\"\n    A Django queryset for the :class:`~atmo.clusters.models.EMRRelease` model.\n    \"\"\"\n    def natural_sort_by_version(self):\n        \"\"\"\n        Sorts this queryset by the EMR version naturally (human-readable).\n        \"\"\"\n        return self.extra(\n            select={\n                'natural_version': \"string_to_array(version, '.')::int[]\",\n            },\n        ).order_by('-natural_version')\n\n    def active(self):\n        return self.filter(\n            is_active=True,\n        )\n\n    def stable(self):\n        \"\"\"\n        The EMR releases that are considered stable.\n        \"\"\"\n        return self.filter(\n            is_experimental=False,\n            is_deprecated=False,\n            is_active=True,\n        )\n\n    def experimental(self):\n        \"\"\"\n        The EMR releases that are considered experimental.\n        \"\"\"\n        return self.filter(\n            is_experimental=True,\n            is_active=True,\n        )\n\n    def deprecated(self):\n        \"\"\"\n        The EMR releases that are deprecated.\n        \"\"\"\n        return self.filter(\n            is_deprecated=True,\n            is_active=True,\n        )\n\n\nclass ClusterQuerySet(models.QuerySet):\n    \"\"\"A Django queryset that filters by cluster status.\n\n    Used by the :class:`~atmo.clusters.models.Cluster` model.\n    \"\"\"\n\n    def active(self):\n        \"\"\"\n        The clusters that have an active status.\n        \"\"\"\n        return self.filter(\n            most_recent_status__in=self.model.ACTIVE_STATUS_LIST,\n        )\n\n    def terminated(self):\n        \"\"\"\n        The clusters that have an terminated status.\n        \"\"\"\n        return self.filter(\n            most_recent_status__in=self.model.TERMINATED_STATUS_LIST,\n        )\n\n    def failed(self):\n        \"\"\"\n        The clusters that have an failed status.\n        \"\"\"\n        return self.filter(\n            most_recent_status__in=self.model.FAILED_STATUS_LIST,\n        )\n", "path": "atmo/clusters/queries.py"}, {"content": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, you can obtain one at http://mozilla.org/MPL/2.0/.\nfrom django import forms\nfrom django.conf import settings\nfrom django.core.urlresolvers import reverse\nfrom django.utils.safestring import mark_safe\n\nfrom . import models\nfrom ..forms.mixins import AutoClassFormMixin, CreatedByModelFormMixin\nfrom ..keys.models import SSHKey\n\n\nclass EMRReleaseChoiceField(forms.ModelChoiceField):\n    \"\"\"\n    A :class:`~django.forms.ModelChoiceField` subclass that uses\n    :class:`~atmo.clusters.models.EMRRelease` objects for the choices\n    and automatically uses a \"radioset\" rendering -- a horizontal button\n    group for easier selection.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        super().__init__(\n            label='EMR release',\n            queryset=models.EMRRelease.objects.active().natural_sort_by_version(),\n            required=True,\n            empty_label=None,\n            widget=forms.RadioSelect(attrs={\n                'required': 'required',\n                'class': 'radioset',\n            }),\n            help_text=models.Cluster.EMR_RELEASE_HELP,\n        )\n\n    def label_from_instance(self, obj):\n        \"\"\"\n        Append the status of the EMR release if it's\n        experimental or deprecated.\n        \"\"\"\n        label = obj.version\n        extra = []\n        if obj.is_experimental:\n            extra.append('<span class=\"label label-info\">experimental</span>')\n        elif obj.is_deprecated:\n            extra.append('<span class=\"label label-warning\">deprecated</span>')\n        if extra:\n            label = mark_safe('%s %s' % (label, ''.join(extra)))\n        return label\n\n\nclass NewClusterForm(AutoClassFormMixin, CreatedByModelFormMixin,\n                     forms.ModelForm):\n    \"\"\"\n    A form used for creating new clusters.\n    \"\"\"\n    prefix = 'new'\n\n    identifier = forms.RegexField(\n        required=True,\n        label='Identifier',\n        regex=r'^[a-z0-9-]{1,100}$',\n        widget=forms.TextInput(attrs={\n            'pattern': r'[a-z0-9-]{1,100}',\n            'data-parsley-pattern-message': 'Identifier contains invalid characters.',\n        }),\n        help_text='A unique identifier for your cluster, visible in '\n                  'the AWS management console. (Lowercase, use hyphens '\n                  'instead of spaces.)'\n    )\n    size = forms.IntegerField(\n        label='Size',\n        required=True,\n        min_value=1,\n        max_value=settings.AWS_CONFIG['MAX_CLUSTER_SIZE'],\n        widget=forms.NumberInput(attrs={\n            'min': '1',\n            'max': str(settings.AWS_CONFIG['MAX_CLUSTER_SIZE']),\n        }),\n        help_text=('Number of workers to use in the cluster, between 1 and %s. '\n                   'For testing or development 1 is recommended.' %\n                   settings.AWS_CONFIG['MAX_CLUSTER_SIZE'])\n    )\n    lifetime = forms.IntegerField(\n        label='Lifetime',\n        required=True,\n        min_value=2,\n        max_value=settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'],\n        widget=forms.NumberInput(attrs={\n            'min': '2',\n            'max': str(settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME']),\n        }),\n        help_text=('Lifetime in hours after which the cluster is automatically '\n                   'terminated, between 2 and %s.' %\n                   settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'])\n    )\n    ssh_key = forms.ModelChoiceField(\n        label='SSH key',\n        queryset=SSHKey.objects.all(),\n        required=True,\n        empty_label=None,\n    )\n    emr_release = EMRReleaseChoiceField()\n\n    class Meta:\n        model = models.Cluster\n        fields = ['identifier', 'size', 'lifetime', 'ssh_key', 'emr_release']\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        user_sshkeys = self.created_by.created_sshkeys.all()\n        self.fields['ssh_key'].queryset = user_sshkeys.all()\n        self.fields['ssh_key'].help_text = (\n            'The SSH key to deploy to the cluster. '\n            'See <a href=\"%s\">your keys</a> or '\n            '<a href=\"%s\">add a new one</a>.' %\n            (reverse('keys-list'), reverse('keys-new'))\n        )\n        # if there are fewer options we just show radio select buttons\n        if user_sshkeys.count() <= 6:\n            self.fields['ssh_key'].widget = forms.RadioSelect(\n                choices=self.fields['ssh_key'].choices,\n                attrs={\n                    'class': 'radioset',\n                },\n            )\n\n\nclass ExtendClusterForm(AutoClassFormMixin, forms.Form):\n    prefix = 'extend'\n    extension = forms.IntegerField(\n        label='Lifetime extension in hours',\n        required=True,\n        min_value=2,\n        max_value=settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'],\n        widget=forms.NumberInput(attrs={\n            'min': '2',\n            'max': str(settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME']),\n        }),\n        help_text=(\"Number of hours to extend the cluster's lifetime with, between 2 and %s.\" %\n                   settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'])\n    )\n", "path": "atmo/clusters/forms.py"}]}