def merge_dicts(*dicts, **kwargs):
    """
    Melts several dicts into one. Useful when messing with feed dicts
    :param dicts: dictionaries
    :param check_conflicts: if True, raises error if several dicts have the same key
                    Otherwise uses the key from the latest dict in *dicts
    :return: a dict that contains k-v pairs from  all *dicts
    """
    merged_dict = {}
    for d in dicts:
        merged_dict.update(d)
    if kwargs.get('check_conflicts'):
        assert len(merged_dict) == sum(
            map(len, dicts)), 'dicts have duplicate keys'
    return merged_dict