regular expression:
https://www.tutorialspoint.com/python/python_reg_expressions.htm
import re
print re.sub('[\s ]+', '', s)
s = s.strip(' \t\n\r')
entries = re.split("\n+", text)
m = re.match("(d\w+)\W(d\w+)", element)
def test1():
text = '"-Abc"'
ret = re.match(r"^\"[^\"]+\"$", text)
print ret
entry = text
#rule 2
entry = re.sub('^[-\"\']+', '', entry)
entry = re.sub('[-\"\']+$', '', entry)
entry = entry.lower()
print entry