def get_display_name(user):
    """
    Tries to return (in order):

        * ``user.profile.display_name``
        * ``user.username``
    """
    if user is None:
        return None
    profile = user.profile
    if profile.display_name:
        return profile.display_name
    return user.username