add an else block here

```
else:
    factor = None
```