def get_user_printable_name(user, errstring="???"):
    """
    Gets name of user in printable form.

    :param user: user object
    :param errstring: string to return if name could not be resolved
    :return: user.nick if exists, user.name otherwise (if exists), errstring if nick and name are missing
    """

    if user is None:
        return errstring
    return user.nick if (user.nick is not None) else (user.name if (user.name is not None) else errstring)