Port of the perl module of the same name.