def sanitize(text):
    """
    We're using a very simple approach to writing a CSV (which is actually
    tab-separated, but a lot of software considers that a kind of CSV). Our
    CSV output will be formatted correctly and understood by psql as long
    as we avoid certain characters that would conflict:

    - Newlines (which of course separate CSV entries)
    - Tabs (which separate our columns)
    - Null codepoints (which are not allowed in psql)

    We also need to escape every literal backslash, as backslashes are
    interpreted by psql.

    It's a good question whether this step should be necessary -- names
    of concepts shouldn't include control characters, and the few
    instances of backslashes in ConceptNet appear to be mistakes.
    """
    return text.replace('\n', '').replace('\t', '').replace('\x00', ''
        ).replace('\\', '\\\\')
