You could change this line to
```
if isinstance(member, Member):