def METHOD_NAME(user, cache_versions):
    ban_cache = user.ban_cache
    ban_cache.cache_version = cache_versions[BANS_CACHE]
    try:
        user_ban = Ban.objects.get_ban(
            username=user.username, email=user.email, registration_only=False
        )
        ban_cache.ban = user_ban
        ban_cache.expires_on = user_ban.expires_on
        ban_cache.user_message = user_ban.user_message
        ban_cache.staff_message = user_ban.staff_message
    except Ban.DoesNotExist:
        ban_cache.ban = None
        ban_cache.expires_on = None
        ban_cache.user_message = None
        ban_cache.staff_message = None
    ban_cache.save()
    return ban_cache