def merge(low, high):
    """
    Merge two configuration sources.

    Arguments:
        low -- the source with lower precedence
        high -- the source with higher precedence

    Returns: a merged configuration
    """

    # bail if merging to an empty higher source
    if high == {}: return low

    merged = {}
    for key, val in low.items():
        merged[key] = high[key] if key in high else val

    return merged