Merge some (untested) functions from Example42's puppi module

From untagged commit f65b71b7c29c6e62ace55359929aae1add3ebc41 at
github.com:example42/puppi.git