def obtain_os_version(show_ver):
 match = re.search('Cisco IOS Software.*Version (.+?),', show_ver)
 if match:
  return match.group(1)
 else:
  return None

def obtain_os_version ( show_ver ) : match = re . search ( 'Cisco IOS Software.*Version (.+?),' , show_ver ) if match : return match . group ( 1 ) else : return None
obtain the os version from the show version output returns os version string or none .