def _purge(dir, pattern, reason='<STR_LIT>'):
for f in os.listdir(dir):<EOL><INDENT>if re.search(pattern, f):<EOL><INDENT>print("<STR_LIT>".format(f, reason))<EOL>os.remove(os.path.join(dir, f))<EOL><DEDENT><DEDENT>
delete files in dir that match pattern