from typing import OrderedDict


def create_model(api, name, fields):
    """Helper for creating api models with ordered fields

    :param flask_restx.Api api: Flask-RESTX Api object
    :param str name: Model name
    :param list fields: List of tuples containing ['field name', <type>]
    """
    d = OrderedDict()
    for field in fields:
        d[field[0]] = field[1]
    return api.model(name, d)