def copy_fields(src, dest, fields=None, dest_fields=None, defaults=None):
    """Copy the k/v pairs from one dict into another"""
    if not fields:
        fields = src.keys()
    if not dest_fields:
        dest_fields = fields
    if not defaults:
        defaults = {}
    for field, dest_field in zip(fields, dest_fields):
        value = src.get(field, None)
        if value is None:
            if field in defaults:
                dest[dest_field] = defaults[field]
        else:
            dest[dest_field] = value
