ksgen: Add limit_chars

This method return cropped first param to specified length. Unfortunately
the input string couldn't be output of another !method.

Change-Id: Ie1c79a11b2a8fc73238b8ce45606ccc29b70fdf6
ksgen: Extend !env to limit maximum length

Added third optional pamrameter to have control under length of returned value.
Also there are a few new unit test.

Change-Id: Id09e18d6479db2c7f8b4e1d1fc54b4ac2364bd1b