from io import StringIO
import csv


def from_csv(value_string):
    """
    Reads a string containing odML values and parses them into a list.

    :param value_string: string of odML values.
    :return: list of values.
    """
    if not value_string:
        return []
    if value_string[0] == "[" and value_string[-1] == "]":
        value_string = value_string[1:-1]
    else:
        # This is a single string entry, any comma contained
        # is part of the value and must not be used to
        # split up the string.
        return [value_string]

    if not value_string:
        return []
    stream = StringIO(value_string)
    stream.seek(0)
    reader = csv.reader(stream, dialect="excel")
    return list(reader)[0]