import re
import ast

test = ("[ \"A\", \"\"B\"\",'C' , \" D\"]\n"
	"[ \"A\", \"'B'\",'C' , \" D\"]\n"
	"[ \"A\", ''B'','C' , \" D\"]\n"
	"[ \"A\", '\"B\"','C' , \" D\"]\n"
	"[ \"A\", '8 o'clock','C' , \" D\"]\n"
	"[ \"A\", \"Ol' 8 o'clock\",'C' , \" D\"]\n"
	"[\"Some Text\"]\n"
	"[\"Some more Text\"]\n"
	"[\"Even more text about \\\"this text\\\"\"]\n"
	"[\"Ol' 8 o'clock\"]\n"
	"['8 o'clock']\n"
	"[ '8 o'clock']\n"
	"['Ol' 8 o'clock']\n"
	"[\"\"B\"]\n"
	"[\"\\\"B\"]\n"
	"[\"\\\\\"B\"]\n"
	"[\"\\\\\\\"B\"]\n"
	"[\"\\\\\\\\\"B\"]")
result = u''
last_index = 0
regex1 = r"(?<=[\[,])\s*(['\"])(?:(\1)|.)*?\1(?=\s*[,\]])" #nested quotes of the same type
regex2 = r'''^"[^"\\]*(?:\\.[^\"\\]*)*"$|^'[^'\\]*(?:\\.[^'\\]*)*'$|^\s*["'][^"'\\]*|["']\s*$|\\.|(["'])[^"'\\\n]*''' # unescaped quotes in $1
matches = re.finditer(regex1, test, re.MULTILINE)
for match in matches:
    if match.groups()[1] is not None: #nested quotes of the same type present
        print(match.group())
        inner = re.finditer(regex2, match.group())
        for m in inner:            
            if m.groups()[0] is not None: # unescaped quotes in $1 present
                result += test[last_index:match.start() + m.start()] + '\\' + m.group()
                last_index = match.start()+m.end()
result += test[last_index:len(test)]
print(result)

for test_str in result.split("\n"):
    List = ast.literal_eval(test_str)
    print(List)
    print(type(List))