Avoid SyntaxWarning by removing unneeded lambda function