Good ideas, I like it. Bonus points for pointing out that it currently matches the end of the path in a docstring, double bonus points if you go ahead and use regex matching-- I don't think an isinstance check is necessary for that, you can just iterate through and feed each string to re.search, which would accomplish the same thing as endswith, effectively.