import csv


def import_table_from_csv(filename):
    """Import tabular data from a csv file.

    :param filename: path to csv file
    :return: tuple of headers (empty if no headers) and rows
    """
    with open(filename, 'r', encoding='utf-8') as file:
        sniffer = csv.Sniffer()
        has_header = sniffer.has_header(file.read(2048))
        file.seek(0)
        rows = list(csv.reader(file))
        if has_header:
            return rows[0], rows[1:]
        return [], rows