Using Selenium within python functions