Refactor _ignore

When scanning large packages, with a large ignore list, I found a performance improvement in reducing the number of calls to **isinstance** and **str.startswith**.

I also think the **_ignore** function reads better now.