I cannot get the following function to run:

```
match, match_score = process.extractOne(score, pct_dict.keys())

```

I get a whitespace error I cannot seem to resolve. Any idea what is causing this?

What it should do: If the score is 15 it should return 0.026

### Error:

> 
> Error: output = self.func(\*resolved\_args, \*\*resolved\_kwargs) wnas1  
> 
>  | File "/code/cleveland/templatetags/percentiles\_ratings.py", line
>  32, in get\_percentile\_standard wnas1 | match, match\_score =
>  process.extractOne(score, pct\_dict.keys()) wnas1 | File
>  "/usr/local/lib/python3.7/site-packages/fuzzywuzzy/process.py", line
>  220, in extractOne wnas1 | return max(best\_list, key=lambda
>  i: i[1]) wnas1 | File
>  "/usr/local/lib/python3.7/site-packages/fuzzywuzzy/process.py", line
>  78, in extractWithoutOrder wnas1 | processed\_query =
>  processor(query) wnas1 | File
>  "/usr/local/lib/python3.7/site-packages/fuzzywuzzy/utils.py", line 95,
>  in full\_process wnas1 | string\_out =
>  StringProcessor.replace\_non\_letters\_non\_numbers\_with\_whitespace(s)
>  wnas1 | File
>  "/usr/local/lib/python3.7/site-packages/fuzzywuzzy/string\_processing.py",
>  line 26, in replace\_non\_letters\_non\_numbers\_with\_whitespace wnas1  
> 
>  | return cls.regex.sub(" ", a\_string)
> 
> 
> 

### Code:

```
from __future__ import unicode_literals
from django import template
from fuzzywuzzy import fuzz
from fuzzywuzzy import process

register = template.Library()

@register.simple_tag
def get_perc(score):
    MATCH_THRESHOLD = 80
    pct_dict = {14: 0.016, 14.7: 0.021, 15.3: 0.026, 16: 0.034, 16.7: 0.04, 17.3: 0.05, 18: 0.07, 18.7: 0.09,
                    19.3: 0.11, 20: 0.13, 20.7: 0.17, 21.3: 0.21, 22: 0.26, 22.7: 0.31, 23.3: 0.38, 24: 0.47}
    if not score:
        return '--'
    elif score < 26.7:
        return '<1'

    match, match_score = process.extractOne(score, pct_dict.keys())

    if match_score >= MATCH_THRESHOLD:
        return pct_dict[match]
    else:
        return '--'

```