```python
local_offset = time.timezone
if time.daylight:
  local_offset = time.altzone
```

This way you comply to the "do not use something defined inside a deeper block".