I think the `and not self.label is None` is redundant. If `self.label` is set to `None` then `label` becomes `None`, which is the same as your `else`. So this could be

```python
if self.legend and hasattr(self, 'label'):
    label = self.label
else:
    label = None
```

unless I'm missing something.