adapting code to google python guidelines