hybrid generate_style for python2 and python3