def METHOD_NAME(data):
    # allow explicit child classes of TableData to be passed to Table()
    if isinstance(data, TableData):
        return data
    if TableQuerysetData.validate(data):
        return TableQuerysetData(data)
    elif TableListData.validate(data):
        return TableListData(list(data))
    raise ValueError(
        "data must be QuerySet-like (have count() and order_by()) or support"
        f" list(data) -- {type(data).__name__} has neither"
    )