Properly attribute backport random code

Include relevant parts of license from backports as attribution for #1418.
Fixes #1418.