Changing extract to support older python