These three lines can be replaced with the following.

```python
Profile.objects.get_or_create(user=instance)
```