#NEWLINE# def parse_name_and_version( p ) : #NEWLINE# #INDENT# "\n    A utility method used to get name and version from a string.\n\n    From e.g. a Provides-Dist value.\n\n    :param p: A value in a form 'foo (1.0)'\n    :return: The name and version as a tuple.\n    " #NEWLINE# m = NAME_VERSION_RE . match ( p ) #NEWLINE# if ( not d ) : #NEWLINE# #INDENT# raise DistlibException ( ( "Ill-formed name/version string: '%s'" % p ) ) #NEWLINE# #UNINDENT# d = m . groupdict ( ) #NEWLINE# return ( d [ 'name' ] . strip ( ) . lower ( ) , d [ 'ver' ] )