def is_authenticated(user):
    """
    Check if a user is authenticated

    In Django 1.10 User.is_authenticated was changed to a property and
    backwards compatible support for is_authenticated being callable was
    finally removed in Django 2.0. This function can be removed once support
    Django versions earlier than 1.10 are dropped.
    """
    if callable(user.is_authenticated):
        return user.is_authenticated()
    else:
        return user.is_authenticated