[utils] change extract_attributes to work in python 2