Use handle's id instead of handle in OccupiedPorts, stay back at 0.1.5.

Use the handle's id to avoid unnecessarily storing a reference to the
handle object beyond its lifetime.

Also, adhere more closely to PEP-8