reduced the redundant code in reduce [refs #255]
reduced the redundant code in reduce [refs #255]

correcting exceptions
pratyakshs/pgmpy,liquidmetal/pgmpy,yashu-seth/pgmpy,liquidmetal/pgmpy,yashu-seth/pgmpy,pgmpy/pgmpy,anaviltripathi/pgmpy,khalibartan/pgmpy,palashahuja/pgmpy,kris-singh/pgmpy,ankurankan/pgmpy,abinashpanda/pgmpy,vivek425ster/pgmpy,ankurankan/pgmpy,vivek425ster/pgmpy,anaviltripathi/pgmpy,sandeepkrjha/pgmpy,abinashpanda/pgmpy,jhonatanoliveira/pgmpy,sandeepkrjha/pgmpy,jhonatanoliveira/pgmpy,pratyakshs/pgmpy,pgmpy/pgmpy,kris-singh/pgmpy,khalibartan/pgmpy,palashahuja/pgmpy