remove some code duplication
remove some code duplication

fabianrost84/cython,hhsprings/cython,acrispin/cython,fabianrost84/cython,c-blake/cython,fabianrost84/cython,ChristopherHogan/cython,roxyboy/cython,scoder/cython,c-blake/cython,JelleZijlstra/cython,dahebolangkuan/cython,fperez/cython,acrispin/cython,andreasvc/cython,hhsprings/cython,achernet/cython,madjar/cython,mcanthony/cython,cython/cython,mcanthony/cython,hickford/cython,dahebolangkuan/cython,achernet/cython,fperez/cython,ABcDexter/cython,JelleZijlstra/cython,marscher/cython,scoder/cython,slonik-az/cython,mcanthony/cython,achernet/cython,dahebolangkuan/cython,c-blake/cython,mrGeen/cython,mrGeen/cython,ABcDexter/cython,roxyboy/cython,encukou/cython,hhsprings/cython,cython/cython,cython/cython,roxyboy/cython,madjar/cython,encukou/cython,c-blake/cython,scoder/cython,JelleZijlstra/cython,ChristopherHogan/cython,roxyboy/cython,madjar/cython,fperez/cython,mrGeen/cython,acrispin/cython,dahebolangkuan/cython,c-blake/cython,andreasvc/cython,marscher/cython,encukou/cython,da-woods/cython,achernet/cython,roxyboy/cython,da-woods/cython,slonik-az/cython,slonik-az/cython,mrGeen/cython,JelleZijlstra/cython,dahebolangkuan/cython,mcanthony/cython,madjar/cython,slonik-az/cython,hickford/cython,JelleZijlstra/cython,madjar/cython,fabianrost84/cython,scoder/cython,andreasvc/cython,marscher/cython,ABcDexter/cython,encukou/cython,hickford/cython,ABcDexter/cython,fperez/cython,achernet/cython,cython/cython,ABcDexter/cython,fabianrost84/cython,marscher/cython,mcanthony/cython,hickford/cython,fperez/cython,andreasvc/cython,acrispin/cython,hhsprings/cython,marscher/cython,ChristopherHogan/cython,encukou/cython,da-woods/cython,da-woods/cython,hhsprings/cython,andreasvc/cython,slonik-az/cython,hickford/cython,acrispin/cython,mrGeen/cython