factory: dict.keys() in py2 change to list(dict)

In python2, dict.keys() return a copy list of keys.
In python3, dict.keys() return an iterator of keys.

The semantic changes, so we need to use list(dict) to get a copy list.

BUG=chromium:999876
TEST=make test

Change-Id: Ic719a5cf08d448241d9f631fcb36103e73940a6b
Reviewed-on: https://chromium-review.googlesource.com/1824719
Tested-by: Yilin Yang <kerker@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Yong Hong <yhong@chromium.org>
diff --git a/py/tools/ghost.py b/py/tools/ghost.py
index 57c1abc..5989b57 100755
--- a/py/tools/ghost.py
+++ b/py/tools/ghost.py
@@ -959,7 +959,7 @@
     If any timed-out requests are discovered, their handler is called with the
     special response value of None.
     """
-    for rid in self._requests.keys()[:]:
+    for rid in list(self._requests):
       request_time, timeout, handler = self._requests[rid]
       if self.Timestamp() - request_time > timeout:
         if callable(handler):