Fix flake9 error: redefinition of function