so something like:
if match and match.groups():

match may often be None.