OSIS-3637 fix codeClimate by extracting code to function
OSIS-3637 fix codeClimate by extracting code to function

uclouvain/OSIS-Louvain,uclouvain/osis,uclouvain/osis,uclouvain/OSIS-Louvain,uclouvain/OSIS-Louvain,uclouvain/osis,uclouvain/osis