prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Improve documentation of view decorators
  Explain what our view decorators are doing and add docstrings of the following format:
  ```
  """
  [Summary]
  
  :param [ParamName]: [ParamDescription], defaults to [DefaultParamVal]
  :type [ParamName]: [ParamType](, optional)
  ...
  :raises [ErrorType]: [ErrorDescription]
  ...
  :return: [ReturnDescription]
  :rtype: [ReturnType]
  """
  ```
  Improve documentation of view decorators
  Explain what our view decorators are doing and add docstrings of the following format:
  ```
  """
  [Summary]
  
  :param [ParamName]: [ParamDescription], defaults to [DefaultParamVal]
  :type [ParamName]: [ParamType](, optional)
  ...
  :raises [ErrorType]: [ErrorDescription]
  ...
  :return: [ReturnDescription]
  :rtype: [ReturnType]
  """
  ```
  
  </issue>
  <code>
  [start of src/cms/decorators.py]
  1 import time
  2 from functools import wraps
  3 
  4 from django.core.exceptions import PermissionDenied
  5 from django.shortcuts import redirect
  6 
  7 from .models import Region
  8 
  9 
  10 def staff_required(function):
  11     @wraps(function)
  12     def wrap(request, *args, **kwargs):
  13         user = request.user
  14         # superusers and staff have access to this areas
  15         if user.is_superuser or user.is_staff:
  16             return function(request, *args, **kwargs)
  17         raise PermissionDenied
  18     return wrap
  19 
  20 
  21 def region_permission_required(function):
  22     @wraps(function)
  23     def wrap(request, *args, **kwargs):
  24         user = request.user
  25         # superusers and staff have permissions for all regions
  26         if user.is_superuser or user.is_staff:
  27             return function(request, *args, **kwargs)
  28         region = Region.get_current_region(request)
  29         if region in user.profile.regions.all():
  30             return function(request, *args, **kwargs)
  31         raise PermissionDenied
  32     return wrap
  33 
  34 def modify_mfa_authenticated(function):
  35     @wraps(function)
  36     def wrap(request, *args, **kwargs):
  37         if not 'modify_mfa_authentication_time' in request.session or request.session['modify_mfa_authentication_time'] < (time.time() - 5 * 60):
  38             request.session['mfa_redirect_url'] = request.path
  39             return redirect('user_settings_auth_modify_mfa')
  40         return function(request, *args, **kwargs)
  41     return wrap
  42
  [end of src/cms/decorators.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/cms/decorators.py b/src/cms/decorators.py
  --- a/src/cms/decorators.py
  +++ b/src/cms/decorators.py
  @@ -1,3 +1,8 @@
  +"""
  +Django view decorators can be used to restrict the execution of a view function on certain conditions.
  +
  +For more information, see :doc:`topics/http/decorators`.
  +"""
   import time
   from functools import wraps
   
  @@ -8,6 +13,15 @@
   
   
   def staff_required(function):
  +    """
  +    This decorator can be used to make sure a view can only be retrieved by users who are either staff or superusers.
  +
  +    :param function: The view function which should be protected
  +    :type function: ~collections.abc.Callable
  +
  +    :return: The decorated function
  +    :rtype: ~collections.abc.Callable
  +    """
       @wraps(function)
       def wrap(request, *args, **kwargs):
           user = request.user
  @@ -19,6 +33,15 @@
   
   
   def region_permission_required(function):
  +    """
  +    This decorator can be used to make sure a view can only be retrieved by users of the requested region.
  +
  +    :param function: The view function which should be protected
  +    :type function: ~collections.abc.Callable
  +
  +    :return: The decorated function
  +    :rtype: ~collections.abc.Callable
  +    """
       @wraps(function)
       def wrap(request, *args, **kwargs):
           user = request.user
  @@ -32,6 +55,15 @@
       return wrap
   
   def modify_mfa_authenticated(function):
  +    """
  +    This decorator can be used to make sure a user can only modify his 2FA settings when he has a valid 2FA session.
  +
  +    :param function: The view function which should be protected
  +    :type function: ~collections.abc.Callable
  +
  +    :return: The decorated function
  +    :rtype: ~collections.abc.Callable
  +    """
       @wraps(function)
       def wrap(request, *args, **kwargs):
           if not 'modify_mfa_authentication_time' in request.session or request.session['modify_mfa_authentication_time'] < (time.time() - 5 * 60):
  
verification_info: {"golden_diff": "diff --git a/src/cms/decorators.py b/src/cms/decorators.py\n--- a/src/cms/decorators.py\n+++ b/src/cms/decorators.py\n@@ -1,3 +1,8 @@\n+\"\"\"\n+Django view decorators can be used to restrict the execution of a view function on certain conditions.\n+\n+For more information, see :doc:`topics/http/decorators`.\n+\"\"\"\n import time\n from functools import wraps\n \n@@ -8,6 +13,15 @@\n \n \n def staff_required(function):\n+    \"\"\"\n+    This decorator can be used to make sure a view can only be retrieved by users who are either staff or superusers.\n+\n+    :param function: The view function which should be protected\n+    :type function: ~collections.abc.Callable\n+\n+    :return: The decorated function\n+    :rtype: ~collections.abc.Callable\n+    \"\"\"\n     @wraps(function)\n     def wrap(request, *args, **kwargs):\n         user = request.user\n@@ -19,6 +33,15 @@\n \n \n def region_permission_required(function):\n+    \"\"\"\n+    This decorator can be used to make sure a view can only be retrieved by users of the requested region.\n+\n+    :param function: The view function which should be protected\n+    :type function: ~collections.abc.Callable\n+\n+    :return: The decorated function\n+    :rtype: ~collections.abc.Callable\n+    \"\"\"\n     @wraps(function)\n     def wrap(request, *args, **kwargs):\n         user = request.user\n@@ -32,6 +55,15 @@\n     return wrap\n \n def modify_mfa_authenticated(function):\n+    \"\"\"\n+    This decorator can be used to make sure a user can only modify his 2FA settings when he has a valid 2FA session.\n+\n+    :param function: The view function which should be protected\n+    :type function: ~collections.abc.Callable\n+\n+    :return: The decorated function\n+    :rtype: ~collections.abc.Callable\n+    \"\"\"\n     @wraps(function)\n     def wrap(request, *args, **kwargs):\n         if not 'modify_mfa_authentication_time' in request.session or request.session['modify_mfa_authentication_time'] < (time.time() - 5 * 60):\n", "issue": "Improve documentation of view decorators\nExplain what our view decorators are doing and add docstrings of the following format:\r\n```\r\n\"\"\"\r\n[Summary]\r\n\r\n:param [ParamName]: [ParamDescription], defaults to [DefaultParamVal]\r\n:type [ParamName]: [ParamType](, optional)\r\n...\r\n:raises [ErrorType]: [ErrorDescription]\r\n...\r\n:return: [ReturnDescription]\r\n:rtype: [ReturnType]\r\n\"\"\"\r\n```\nImprove documentation of view decorators\nExplain what our view decorators are doing and add docstrings of the following format:\r\n```\r\n\"\"\"\r\n[Summary]\r\n\r\n:param [ParamName]: [ParamDescription], defaults to [DefaultParamVal]\r\n:type [ParamName]: [ParamType](, optional)\r\n...\r\n:raises [ErrorType]: [ErrorDescription]\r\n...\r\n:return: [ReturnDescription]\r\n:rtype: [ReturnType]\r\n\"\"\"\r\n```\n", "before_files": [{"content": "import time\nfrom functools import wraps\n\nfrom django.core.exceptions import PermissionDenied\nfrom django.shortcuts import redirect\n\nfrom .models import Region\n\n\ndef staff_required(function):\n    @wraps(function)\n    def wrap(request, *args, **kwargs):\n        user = request.user\n        # superusers and staff have access to this areas\n        if user.is_superuser or user.is_staff:\n            return function(request, *args, **kwargs)\n        raise PermissionDenied\n    return wrap\n\n\ndef region_permission_required(function):\n    @wraps(function)\n    def wrap(request, *args, **kwargs):\n        user = request.user\n        # superusers and staff have permissions for all regions\n        if user.is_superuser or user.is_staff:\n            return function(request, *args, **kwargs)\n        region = Region.get_current_region(request)\n        if region in user.profile.regions.all():\n            return function(request, *args, **kwargs)\n        raise PermissionDenied\n    return wrap\n\ndef modify_mfa_authenticated(function):\n    @wraps(function)\n    def wrap(request, *args, **kwargs):\n        if not 'modify_mfa_authentication_time' in request.session or request.session['modify_mfa_authentication_time'] < (time.time() - 5 * 60):\n            request.session['mfa_redirect_url'] = request.path\n            return redirect('user_settings_auth_modify_mfa')\n        return function(request, *args, **kwargs)\n    return wrap\n", "path": "src/cms/decorators.py"}]}