Fix number of arguments check in flatten()

The function only uses the first argument, so raise an error with
too few arguments *and* with too many arguments.
Merge branch 'pull-98' into 2.x
Merge branch '2.x' into 3.x
Merge branch '3.x' into 4.x
str2bool should return a boolean if called with a boolean
Merge branch 'pull-115' into 2.x
Merge branch '2.x' into 3.x
Merge branch '3.x' into 4.x
Merge branch '4.x'