Implementation of Grep In Python