% for import_ in imports:
${import_}
% endfor

% for model in models:
${model}
% endfor

async def ${function_name}(connection: Connection, timeout: timedelta | None = None) -> Sequence[${model_name}]:
    query = """
    ${query}
"""
    records = await connection.fetch(query, timeout=timeout.total_seconds() if timeout is not None else None)
    return convert_records_to_pydantic_models(records=records, pydantic_model_type=${model_name})
