Clarification:
```
if f[0] == 'X': 
    return x
```
would have worked as intended as well.