This is just copied from the require module we use in PM/thimble already