code: def get_platform():
      
      mac_version = str(platform.mac_ver()[0]).strip()    # e.g. 10.11.2
      if mac_version:
          return 'OS X %s' % mac_version
      return platform.platform().strip()
docs: get Mac OS X version or kernel version if mac version is not found