Could you also add a note from which version this was copypasta'd? (Maybe a link to the original tagged source?)

Maybe it'd be less work to vendor in the full module and just use a part of it? Could be easier to maintain it later.