Parts: Refactor search to accomodate recent changes.

Various PEP8 fixes.