'Extract a list from the given fields.'

def _ExtractList(self, fields, ignores=(',',), terminators=()):

    extracted = []
    i = 0
    for (i, field) in enumerate(fields):
        if (field in ignores):
            continue
        if (field in terminators):
            break
        extracted.append(field.strip(''.join(ignores)))
        if (not (field.endswith(',') or set(fields[(i + 1):(i + 2)]).intersection(ignores))):
            break
    return (extracted, fields[(i + 1):])
