def diff(x, y):
    """Return absolute difference between x and y, assumed to be of the same basic type
    
    if numeric and neither is missing (None), return ordinary absolute value
    if not numeric, return 0 if identical and not blank.
    Otherwise return BIG."""

    BIG = 1e100

    try:
        return abs(x - y)
    except:
        if isinstance(x, str):
            x = x.rstrip()
            y = y.rstrip()
            if x == y and x != "":
                return 0
        return BIG