import math
import functools


def coalesce(*options):
    """
    Args:
        *options: A list of objects some of which might be None, ending in a default value.

    Returns:
        The leftmost object in the list that is not None, '', or NaN. If no
        such objects exist, returns the rightmost object in the list, or None
        if called with no arguments.
    Examples:
        >>> coalesce()
        >>> coalesce(None)
        >>> coalesce(None, 'a')
        'a'
        >>> coalesce(None, None, 'a')
        'a'
        >>> coalesce(None, 'a', 'b')
        'a'
        >>> coalesce('', 'a')
        'a'
        >>> coalesce(float('nan'), 'a')
        'a'
        >>> coalesce(None, None, 'c')
        'c'
    """
    # pseudocode for list comp version:
    # [o for o in options if o is not None and o != '' and o is not NaN][0]
    def coalesce2(option_a, option_b):
        try:
            if math.isnan(option_a):
                return option_b
        except:
            pass
        if option_a is None:
            return option_b
        elif option_a == '':
            return option_b
        else:
            return option_a

    return functools.reduce(coalesce2, options, None)