def METHOD_NAME(items, type_):
    if not items:
        return None
    for item in items:
        if item.get("type") == type_:
            return item
    return items[0]  # fall back to the first one