secondquant: a little refactoring + more docstrings added
secondquant: a little refactoring + more docstrings added

The nested functions were put at the module level, otherwise the docstrings
were not executed properly.

wanglongqi/sympy,jaimahajan1997/sympy,cswiercz/sympy,wanglongqi/sympy,Gadal/sympy,Vishluck/sympy,Curious72/sympy,jaimahajan1997/sympy,sahmed95/sympy,AunShiLord/sympy,oliverlee/sympy,jerli/sympy,farhaanbukhsh/sympy,toolforger/sympy,abloomston/sympy,skidzo/sympy,Designist/sympy,atsao72/sympy,rahuldan/sympy,Mitchkoens/sympy,yashsharan/sympy,kumarkrishna/sympy,VaibhavAgarwalVA/sympy,sunny94/temp,sahilshekhawat/sympy,drufat/sympy,Vishluck/sympy,postvakje/sympy,skidzo/sympy,maniteja123/sympy,yukoba/sympy,mafiya69/sympy,moble/sympy,grevutiu-gabriel/sympy,ahhda/sympy,shipci/sympy,abhiii5459/sympy,meghana1995/sympy,lidavidm/sympy,minrk/sympy,AkademieOlympia/sympy,abhiii5459/sympy,garvitr/sympy,chaffra/sympy,hrashk/sympy,abloomston/sympy,maniteja123/sympy,shikil/sympy,beni55/sympy,kumarkrishna/sympy,kevalds51/sympy,AkademieOlympia/sympy,MechCoder/sympy,jerli/sympy,madan96/sympy,skirpichev/omg,cccfran/sympy,yashsharan/sympy,lindsayad/sympy,MechCoder/sympy,amitjamadagni/sympy,Gadal/sympy,Arafatk/sympy,aktech/sympy,sahmed95/sympy,ga7g08/sympy,jbbskinny/sympy,kumarkrishna/sympy,postvakje/sympy,Sumith1896/sympy,ahhda/sympy,sampadsaha5/sympy,madan96/sympy,Shaswat27/sympy,kaichogami/sympy,wanglongqi/sympy,sahilshekhawat/sympy,shipci/sympy,cswiercz/sympy,Curious72/sympy,madan96/sympy,Davidjohnwilson/sympy,Gadal/sympy,yukoba/sympy,fperez/sympy,cccfran/sympy,kaichogami/sympy,Titan-C/sympy,oliverlee/sympy,mcdaniel67/sympy,saurabhjn76/sympy,AunShiLord/sympy,iamutkarshtiwari/sympy,rahuldan/sympy,chaffra/sympy,tovrstra/sympy,mafiya69/sympy,minrk/sympy,ga7g08/sympy,Arafatk/sympy,wyom/sympy,amitjamadagni/sympy,vipulroxx/sympy,pandeyadarsh/sympy,rahuldan/sympy,MridulS/sympy,souravsingh/sympy,sahilshekhawat/sympy,iamutkarshtiwari/sympy,VaibhavAgarwalVA/sympy,Arafatk/sympy,kevalds51/sympy,grevutiu-gabriel/sympy,diofant/diofant,emon10005/sympy,MechCoder/sympy,Vishluck/sympy,grevutiu-gabriel/sympy,MridulS/sympy,mcdaniel67/sympy,drufat/sympy,hrashk/sympy,shipci/sympy,debugger22/sympy,yukoba/sympy,kmacinnis/sympy,flacjacket/sympy,dqnykamp/sympy,shikil/sympy,chaffra/sympy,pernici/sympy,wyom/sympy,bukzor/sympy,wyom/sympy,souravsingh/sympy,debugger22/sympy,sunny94/temp,hargup/sympy,jamesblunt/sympy,Titan-C/sympy,Shaswat27/sympy,ChristinaZografou/sympy,kmacinnis/sympy,abloomston/sympy,jaimahajan1997/sympy,atreyv/sympy,aktech/sympy,atsao72/sympy,maniteja123/sympy,ChristinaZografou/sympy,mafiya69/sympy,hrashk/sympy,vipulroxx/sympy,vipulroxx/sympy,atreyv/sympy,farhaanbukhsh/sympy,jerli/sympy,saurabhjn76/sympy,meghana1995/sympy,oliverlee/sympy,atsao72/sympy,bukzor/sympy,skidzo/sympy,Sumith1896/sympy,meghana1995/sympy,drufat/sympy,emon10005/sympy,liangjiaxing/sympy,Designist/sympy,jbbskinny/sympy,farhaanbukhsh/sympy,shikil/sympy,dqnykamp/sympy,beni55/sympy,kaushik94/sympy,sunny94/temp,pbrady/sympy,debugger22/sympy,lidavidm/sympy,sampadsaha5/sympy,saurabhjn76/sympy,beni55/sympy,lindsayad/sympy,pbrady/sympy,pbrady/sympy,AunShiLord/sympy,MridulS/sympy,dqnykamp/sympy,jamesblunt/sympy,asm666/sympy,pandeyadarsh/sympy,moble/sympy,jbbskinny/sympy,emon10005/sympy,sahmed95/sympy,cswiercz/sympy,sampadsaha5/sympy,moble/sympy,Sumith1896/sympy,atreyv/sympy,Mitchkoens/sympy,ga7g08/sympy,hargup/sympy,garvitr/sympy,asm666/sympy,abhiii5459/sympy,Davidjohnwilson/sympy,mcdaniel67/sympy,liangjiaxing/sympy,yashsharan/sympy,bukzor/sympy,souravsingh/sympy,kaushik94/sympy,lidavidm/sympy,pandeyadarsh/sympy,asm666/sympy,Davidjohnwilson/sympy,hargup/sympy,Shaswat27/sympy,Titan-C/sympy,kaushik94/sympy,postvakje/sympy,srjoglekar246/sympy,ahhda/sympy,cccfran/sympy,lindsayad/sympy,Curious72/sympy,garvitr/sympy,AkademieOlympia/sympy,jamesblunt/sympy,liangjiaxing/sympy,ChristinaZografou/sympy,VaibhavAgarwalVA/sympy,aktech/sympy,toolforger/sympy,Designist/sympy,kmacinnis/sympy,iamutkarshtiwari/sympy,toolforger/sympy,kevalds51/sympy,Mitchkoens/sympy,mattpap/sympy-polys,kaichogami/sympy