def user_display_name(user):
    '\n    Returns the preferred display name for the given user object: the result of\n    user.get_full_name() if implemented and non-empty, or user.get_username() otherwise.\n    '
    try:
        full_name = user.get_full_name().strip()
        if full_name:
            return full_name
    except AttributeError:
        pass
    try:
        return user.get_username()
    except AttributeError:
        return ''
Returns the preferred display name for the given user object: the result of
user.get_full_name() if implemented and non-empty, or user.get_username() otherwise.
def user_display_name(user):
    '\n    Returns the preferred display name for the given user object: the result of\n    user.get_full_name() if implemented and non-empty, or user.get_username() otherwise.\n    '
    try:
        full_name = user.get_full_name().strip()
        if full_name:
            return full_name
    except AttributeError:
        pass
    try:
        return user.get_username()
    except AttributeError:
        return 