def merge_dicts(*dict_args):
    """
    Given any number of dicts, shallow copy and merge into a new dict,
    precedence goes to key value pairs in earlier dicts.

    Modified from http://stackoverflow.com/a/26853961/554546
    :param list[dict] dict_args: An iterable of dictionaries.
    :return: A dictionary merged as above.
    :rtype: dict
    """
    result = {}
    for dictionary in reversed(dict_args):
        result.update(dictionary)
    return result