<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def username_or(user, attr):
 """ Returns the user's username for display, or an alternate attribute if ``ACCOUNTS_NO_USERNAME`` is set to ``True``. """

    if not settings.ACCOUNTS_NO_USERNAME:
        attr = "username"
    value = getattr(user, attr)
    if callable(value):
        value = value()
    return value