Domanda di colloquio di Semrush

How would you refactor this big function?