def swagger_type_to_pydantic_type(t, models=[]):
    """Given a swagger type or format or ref definition, return its corresponding python type"""
    # Take a swagger type and return the corresponding python type
    if t in models:
        return t

    mapping = {
        # swagger type: pydantic type (https://pydantic-docs.helpmanual.io/usage/types)
        'boolean': 'bool',
        'int32': 'int',
        'integer': 'int',
        'string': 'str',
        'number': 'float',
        'date': 'datetime',
        'datetime': 'datetime',
        'date-time': 'datetime',
        'iso-date': 'datetime',
    }

    assert t in mapping, f"Don't know to map swagger type '{t}' to a python type"

    return mapping[t]