def parse_name_and_version(p):
m = NAME_VERSION_RE.match(p)<EOL>if not m:<EOL><INDENT>raise DistlibException('<STR_LIT>' % p)<EOL><DEDENT>d = m.groupdict()<EOL>return d['<STR_LIT:name>'].strip().lower(), d['<STR_LIT>']<EOL>
A utility method used to get name and version from a string.

From e.g. a Provides-Dist value.

:param p: A value in a form 'foo (1.0)'
:return: The name and version as a tuple.