def getchain(dct, keys, default=None):
    """
    Returns:
        The first value for which a key actually exists in dct, otherwise the
        default value.

    Args:
        dct (dict): The dict to look up keys in
        keys (iterable): A list of keys to try to look up in the dictionary, in
                         order. The first one that is actually in the dictionary
                         is the one that will have its value returned.
        default: The value to return if none of the keys are in dct

    Notes:
        getchain(dct, ['foo', 'bar', 'baz'], default='default') == dct.get('foo', dct.get('bar', dct.get('baz', 'default')))
    """

    # Old Implemtation (has the disadvantage of doing as many lookups as there
    # are keys, even if the first key is in the dict):

    # if not keys:
    #     return default
    # else:
    #     return dct.get(
    #         keys[0],
    #         getchain(dct, keys[1:], default=default)
    #     )

    # Iterator-oriented version (does not work if dct contains values of None):

    # vals = (dct.get(key) for key in keys)
    # non_none_vals = (val for val in vals if val is not None)
    # return first(chain(non_none_vals, default))

    for key in keys:
        if key in dct:
            return dct[key]
    else:
        return default