prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Domain request table: Capture the "CISA region" a `domain request` is in
  ### Issue description
  
  _As an analyst
  I want to know which [CISA region](https://www.cisa.gov/about/regions) a request is in 
  so that if my research doesn't determine a request is authentic/eligible, I can know which region I need to reach out to_
  
  Each US state/territory is in a "CISA region". When we need additional assistance in verification, we can reach out to regional contacts. Having regional designations in-registrar means we don't have to look it up, saving analyst time.
  
  ### Acceptance criteria
  
  - [ ] For **non-federal requests**, the domain request detail page shows the CISA Region number based on the state abbreviation code of the organization address in the request. (See markup in "Additional Context")
  - [ ] For **federal requests**, the domain request detail page shows "N/A" for the CISA region number, and no table lookup is necessary.
  - [ ] The CISA region is not displayed on any user-facing views.
  
  ### Additional context
  Please make this reusable by domain information as well. consider domain helper or other utility that can then take in the org address state/territory abbreviation and returns the number for the region. Regions and state abbreviations haven't changed in a long time and aren't expected to change in the future, they do not need to be in a table and a simple dictionary lookup (while ugly) is probably the simplest solution.
  
  Based on the official two-letter state/territory abbreviation from the organization address, use the data in the following table to determine the region number:
  
  | Region | Locales |
  | ------- | ----- |
  | 1 |Connecticut, Maine, Massachusetts, New Hampshire, Rhode Island, Vermont|
  | 2 |New Jersey, New York, Puerto Rico, U.S. Virgin Islands|
  |3| Delaware, District of Columbia, Maryland, Pennsylvania, Virginia, West Virginia|
  |4| Alabama, Florida, Georgia, Kentucky, Mississippi, North Carolina, South Carolina, Tennessee|
  |5| Illinois, Indiana, Michigan, Minnesota, Ohio, Wisconsin|
  |6| Arkansas, Louisiana, New Mexico, Oklahoma, Texas|
  |7|Iowa, Kansas, Missouri, Nebraska|
  |8|Colorado, Montana, North Dakota, South Dakota, Utah, Wyoming|
  |9|Arizona, California, Hawaii, Nevada, Guam, American Samoa, Commonwealth of the Northern Mariana Islands|
  |10|Alaska, Idaho, Oregon, Washington|
  
  Click Image to open Miro:
  [![Image](https://github.com/cisagov/manage.get.gov/assets/62573986/bca81201-ce20-409b-bb31-10bca552ed23)](https://miro.com/app/board/uXjVKNvtde0=/?moveToWidget=3458764587423408611&cot=14)
  
  ### Links to other issues
  
  Blocks #2095 
  
  </issue>
  <code>
  [start of src/registrar/templatetags/custom_filters.py]
  1 import logging
  2 from django import template
  3 import re
  4 from registrar.models.domain_request import DomainRequest
  5 
  6 register = template.Library()
  7 logger = logging.getLogger(__name__)
  8 
  9 
  10 @register.filter(name="extract_value")
  11 def extract_value(html_input):
  12     match = re.search(r'value="([^"]*)"', html_input)
  13     if match:
  14         return match.group(1)
  15     return ""
  16 
  17 
  18 @register.filter
  19 def extract_a_text(value):
  20     # Use regex to extract the text within the <a> tag
  21     pattern = r"<a\b[^>]*>(.*?)</a>"
  22     match = re.search(pattern, value)
  23     if match:
  24         extracted_text = match.group(1)
  25     else:
  26         extracted_text = ""
  27 
  28     return extracted_text
  29 
  30 
  31 @register.filter
  32 def find_index(haystack, needle):
  33     try:
  34         return haystack.index(needle)
  35     except ValueError:
  36         return -1
  37 
  38 
  39 @register.filter
  40 def slice_after(value, substring):
  41     index = value.find(substring)
  42     if index != -1:
  43         result = value[index + len(substring) :]
  44         return result
  45     return value
  46 
  47 
  48 @register.filter
  49 def contains_checkbox(html_list):
  50     for html_string in html_list:
  51         if re.search(r'<input[^>]*type="checkbox"', html_string):
  52             return True
  53     return False
  54 
  55 
  56 @register.filter
  57 def get_organization_long_name(generic_org_type):
  58     organization_choices_dict = dict(DomainRequest.OrganizationChoicesVerbose.choices)
  59     long_form_type = organization_choices_dict[generic_org_type]
  60     if long_form_type is None:
  61         logger.error("Organization type error, triggered by a template's custom filter")
  62         return "Error"
  63 
  64     return long_form_type
  65 
  66 
  67 @register.filter(name="has_permission")
  68 def has_permission(user, permission):
  69     return user.has_perm(permission)
  70
  [end of src/registrar/templatetags/custom_filters.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/registrar/templatetags/custom_filters.py b/src/registrar/templatetags/custom_filters.py
  --- a/src/registrar/templatetags/custom_filters.py
  +++ b/src/registrar/templatetags/custom_filters.py
  @@ -67,3 +67,69 @@
   @register.filter(name="has_permission")
   def has_permission(user, permission):
       return user.has_perm(permission)
  +
  +
  +@register.filter
  +def get_region(state):
  +    if state and isinstance(state, str):
  +        regions = {
  +            "CT": 1,
  +            "ME": 1,
  +            "MA": 1,
  +            "NH": 1,
  +            "RI": 1,
  +            "VT": 1,
  +            "NJ": 2,
  +            "NY": 2,
  +            "PR": 2,
  +            "VI": 2,
  +            "DE": 3,
  +            "DC": 3,
  +            "MD": 3,
  +            "PA": 3,
  +            "VA": 3,
  +            "WV": 3,
  +            "AL": 4,
  +            "FL": 4,
  +            "GA": 4,
  +            "KY": 4,
  +            "MS": 4,
  +            "NC": 4,
  +            "SC": 4,
  +            "TN": 4,
  +            "IL": 5,
  +            "IN": 5,
  +            "MI": 5,
  +            "MN": 5,
  +            "OH": 5,
  +            "WI": 5,
  +            "AR": 6,
  +            "LA": 6,
  +            "NM": 6,
  +            "OK": 6,
  +            "TX": 6,
  +            "IA": 7,
  +            "KS": 7,
  +            "MO": 7,
  +            "NE": 7,
  +            "CO": 8,
  +            "MT": 8,
  +            "ND": 8,
  +            "SD": 8,
  +            "UT": 8,
  +            "WY": 8,
  +            "AZ": 9,
  +            "CA": 9,
  +            "HI": 9,
  +            "NV": 9,
  +            "GU": 9,
  +            "AS": 9,
  +            "MP": 9,
  +            "AK": 10,
  +            "ID": 10,
  +            "OR": 10,
  +            "WA": 10,
  +        }
  +        return regions.get(state.upper(), "N/A")
  +    else:
  +        return None
  
verification_info: {"golden_diff": "diff --git a/src/registrar/templatetags/custom_filters.py b/src/registrar/templatetags/custom_filters.py\n--- a/src/registrar/templatetags/custom_filters.py\n+++ b/src/registrar/templatetags/custom_filters.py\n@@ -67,3 +67,69 @@\n @register.filter(name=\"has_permission\")\n def has_permission(user, permission):\n     return user.has_perm(permission)\n+\n+\n+@register.filter\n+def get_region(state):\n+    if state and isinstance(state, str):\n+        regions = {\n+            \"CT\": 1,\n+            \"ME\": 1,\n+            \"MA\": 1,\n+            \"NH\": 1,\n+            \"RI\": 1,\n+            \"VT\": 1,\n+            \"NJ\": 2,\n+            \"NY\": 2,\n+            \"PR\": 2,\n+            \"VI\": 2,\n+            \"DE\": 3,\n+            \"DC\": 3,\n+            \"MD\": 3,\n+            \"PA\": 3,\n+            \"VA\": 3,\n+            \"WV\": 3,\n+            \"AL\": 4,\n+            \"FL\": 4,\n+            \"GA\": 4,\n+            \"KY\": 4,\n+            \"MS\": 4,\n+            \"NC\": 4,\n+            \"SC\": 4,\n+            \"TN\": 4,\n+            \"IL\": 5,\n+            \"IN\": 5,\n+            \"MI\": 5,\n+            \"MN\": 5,\n+            \"OH\": 5,\n+            \"WI\": 5,\n+            \"AR\": 6,\n+            \"LA\": 6,\n+            \"NM\": 6,\n+            \"OK\": 6,\n+            \"TX\": 6,\n+            \"IA\": 7,\n+            \"KS\": 7,\n+            \"MO\": 7,\n+            \"NE\": 7,\n+            \"CO\": 8,\n+            \"MT\": 8,\n+            \"ND\": 8,\n+            \"SD\": 8,\n+            \"UT\": 8,\n+            \"WY\": 8,\n+            \"AZ\": 9,\n+            \"CA\": 9,\n+            \"HI\": 9,\n+            \"NV\": 9,\n+            \"GU\": 9,\n+            \"AS\": 9,\n+            \"MP\": 9,\n+            \"AK\": 10,\n+            \"ID\": 10,\n+            \"OR\": 10,\n+            \"WA\": 10,\n+        }\n+        return regions.get(state.upper(), \"N/A\")\n+    else:\n+        return None\n", "issue": "Domain request table: Capture the \"CISA region\" a `domain request` is in\n### Issue description\n\n_As an analyst\nI want to know which [CISA region](https://www.cisa.gov/about/regions) a request is in \nso that if my research doesn't determine a request is authentic/eligible, I can know which region I need to reach out to_\n\nEach US state/territory is in a \"CISA region\". When we need additional assistance in verification, we can reach out to regional contacts. Having regional designations in-registrar means we don't have to look it up, saving analyst time.\n\n### Acceptance criteria\n\n- [ ] For **non-federal requests**, the domain request detail page shows the CISA Region number based on the state abbreviation code of the organization address in the request. (See markup in \"Additional Context\")\n- [ ] For **federal requests**, the domain request detail page shows \"N/A\" for the CISA region number, and no table lookup is necessary.\n- [ ] The CISA region is not displayed on any user-facing views.\n\n### Additional context\nPlease make this reusable by domain information as well. consider domain helper or other utility that can then take in the org address state/territory abbreviation and returns the number for the region. Regions and state abbreviations haven't changed in a long time and aren't expected to change in the future, they do not need to be in a table and a simple dictionary lookup (while ugly) is probably the simplest solution.\n\nBased on the official two-letter state/territory abbreviation from the organization address, use the data in the following table to determine the region number:\n\n| Region | Locales |\n| ------- | ----- |\n| 1 |Connecticut, Maine, Massachusetts, New Hampshire, Rhode Island, Vermont|\n| 2 |New Jersey, New York, Puerto Rico, U.S. Virgin Islands|\n|3| Delaware, District of Columbia, Maryland, Pennsylvania, Virginia, West Virginia|\n|4| Alabama, Florida, Georgia, Kentucky, Mississippi, North Carolina, South Carolina, Tennessee|\n|5| Illinois, Indiana, Michigan, Minnesota, Ohio, Wisconsin|\n|6| Arkansas, Louisiana, New Mexico, Oklahoma, Texas|\n|7|Iowa, Kansas, Missouri, Nebraska|\n|8|Colorado, Montana, North Dakota, South Dakota, Utah, Wyoming|\n|9|Arizona, California, Hawaii, Nevada, Guam, American Samoa, Commonwealth of the Northern Mariana Islands|\n|10|Alaska, Idaho, Oregon, Washington|\n\nClick Image to open Miro:\n[![Image](https://github.com/cisagov/manage.get.gov/assets/62573986/bca81201-ce20-409b-bb31-10bca552ed23)](https://miro.com/app/board/uXjVKNvtde0=/?moveToWidget=3458764587423408611&cot=14)\n\n### Links to other issues\n\nBlocks #2095 \n", "before_files": [{"content": "import logging\nfrom django import template\nimport re\nfrom registrar.models.domain_request import DomainRequest\n\nregister = template.Library()\nlogger = logging.getLogger(__name__)\n\n\n@register.filter(name=\"extract_value\")\ndef extract_value(html_input):\n    match = re.search(r'value=\"([^\"]*)\"', html_input)\n    if match:\n        return match.group(1)\n    return \"\"\n\n\n@register.filter\ndef extract_a_text(value):\n    # Use regex to extract the text within the <a> tag\n    pattern = r\"<a\\b[^>]*>(.*?)</a>\"\n    match = re.search(pattern, value)\n    if match:\n        extracted_text = match.group(1)\n    else:\n        extracted_text = \"\"\n\n    return extracted_text\n\n\n@register.filter\ndef find_index(haystack, needle):\n    try:\n        return haystack.index(needle)\n    except ValueError:\n        return -1\n\n\n@register.filter\ndef slice_after(value, substring):\n    index = value.find(substring)\n    if index != -1:\n        result = value[index + len(substring) :]\n        return result\n    return value\n\n\n@register.filter\ndef contains_checkbox(html_list):\n    for html_string in html_list:\n        if re.search(r'<input[^>]*type=\"checkbox\"', html_string):\n            return True\n    return False\n\n\n@register.filter\ndef get_organization_long_name(generic_org_type):\n    organization_choices_dict = dict(DomainRequest.OrganizationChoicesVerbose.choices)\n    long_form_type = organization_choices_dict[generic_org_type]\n    if long_form_type is None:\n        logger.error(\"Organization type error, triggered by a template's custom filter\")\n        return \"Error\"\n\n    return long_form_type\n\n\n@register.filter(name=\"has_permission\")\ndef has_permission(user, permission):\n    return user.has_perm(permission)\n", "path": "src/registrar/templatetags/custom_filters.py"}]}