if -e wasn't used, don't even bother with the .groups attribute
(some people apparently have instances with 0 groups? perhaps VPC instances..)
Also, pep8ified.