Use unittest.mock if exists.
Revert mis-committed change.
Merge pull request #2451 from methane/use-std-mock

Use unittest.mock if exists. Fixes #2451.