Possibly... this is the approach used by `django.contrib.auth.get_user()` where this logic was in the [original PR](https://github.com/django/django/pull/2113).

@PaulMcMillan could you review?