A regex extractor in python