def update_form_from_dict(form, field_dict):
    """Update WTForm field values from Python dictionary"""
    for field in form:
        if field.name in field_dict.keys():
            value = field_dict[field.name]
            if field.type == "FieldList":
                if not isinstance(value, list):
                    value = [value]
                for index in range(len(field)):
                    try:
                        field[index].data = value[index]
                        field[index].raw_data = None
                    except:
                        field[index].data = None
                        field[index].raw_data = None
            else:
                field.data = value
                field.raw_data = None

    return form