Function To Find Substring In Python