code: def parse(version):
      
      match = _REGEX.match(version)
      if match is None:
          raise ValueError('%s is not valid SemVer string' % version)
  
      version_parts = match.groupdict()
  
      version_parts['major'] = int(version_parts['major'])
      version_parts['minor'] = int(version_parts['minor'])
      version_parts['patch'] = int(version_parts['patch'])
  
      return version_parts
docs: Parse version to major, minor, patch, pre-release, build parts.
  
      :param version: version string
      :return: dictionary with the keys 'build', 'major', 'minor', 'patch',
               and 'prerelease'. The prerelease or build keys can be None
               if not provided
      :rtype: dict
  
      >>> import semver
      >>> ver = semver.parse('3.4.5-pre.2+build.4')
      >>> ver['major']
      3
      >>> ver['minor']
      4
      >>> ver['patch']
      5
      >>> ver['prerelease']
      'pre.2'
      >>> ver['build']
      'build.4'