Imported from https://github.com/prittjam/repeats