def nonzero(upper, lower):
    """Fills both values to whichever evaluates True, or leaves in place."""
    if upper and not lower:
        return upper, upper
    elif lower and not upper:
        return lower, lower
    else:
        return upper, lower
