from typing import OrderedDict


def fields_to_dict(fields, type_=OrderedDict):
    """Convert a flat list of key/values into an OrderedDict"""
    fields_iterator = iter(fields)
    return type_(zip(fields_iterator, fields_iterator))