import csv


def detect(stream):
    """Returns True if given stream is valid CSV."""
    try:
        csv.Sniffer().sniff(stream, delimiters=',')
        return True
    except (csv.Error, TypeError):
        return False