def coalesce(*fields, **kwargs):
    missing = kwargs.get('missing', None)
    default = kwargs.get('default', None)

    def _coalesce(row):
        for f in fields:
            v = row[f]
            if v is not missing:
                return v
        return default

    return _coalesce
Return a function which accepts a row and returns the first non-missing
dataset/ETHPy150Open alimanfoo/petl/petl/util/misc.py/coalesce