Created grouping by instance
Added test for write pin dict
PEP-8 Fixes