def mk_scan_mapper(condition_map, dflt=None):
    """Make function implementing an if/elif/.../else logic from a {bool_func: x, ...} map"""

    def scan_mapping(x):
        for condition, then in condition_map.items():
            if condition(x):
                return then
        return dflt

    return scan_mapping