Imported from https://github.com/hyperopt/hyperopt