Fix all breakage from not having a baseDN as a fixed static variable
Introduced helper functions build_dn and build_base_dn to handle picking
up the correct DN if null value is passed (we need a baseDN)
Some minor cleanups along with silencing of some pep8 errors