def checkStatSource(statSource): validStatSource = ["peer", "client", "server", "sip"] foundStat = False if re.findall('|'.join(validStatSource), statSource): foundStat = True return foundStat