How To Match Particular String In Python Methods